Giter Club home page Giter Club logo

macenv's Introduction

macenv

Create a sandboxed environment on MacOS

This is an alternative to using MacOS containers and chroot, which require disabling System Integrity Protection (SIP).

The script uses the sandbox-exec command to limit the scope of what can be done within the environment. A config.sb file is generated, which contains a minimal set of permissions. If needed, the configuration can be altered to suit your needs. Mozilla has documentation on sandbox profiles. You can also refer to the profiles in the /System/Library/Sandbox/Profiles directory on your system.

Installation

make install

Usage

usage: macenv (ls|create|rm|cp|ln|exec) ENV ...

Example

$ macenv create myenv
$ macenv ls
myenv
$ touch foo bar
# If no destination is specified, the file is copied to the root of the env
$ macenv cp myenv foo
$ macenv cp myenv foo foo2
# If the destination ends in a slash, the source file name is preserved and the destination is created as a directory
$ macenv cp myenv foo dir/
$ macenv ln myenv bar bar2
$ macenv exec myenv 'find .'
.
./bar2
./.config.sb
./foo
./dir
./dir/foo
./foo2
$ macenv exec myenv 'ls -l bar2'
lrwxr-xr-x  1 jdoe  staff  64 Jan 23 23:54 bar2 -> /Users/jdoe/bar
$ macenv exec myenv bash

The default interactive shell is now zsh.
To update your account to use zsh, please run `chsh -s /bin/zsh`.
For more details, please visit https://support.apple.com/kb/HT208050.
bash-3.2$ env
TERM=xterm-256color
SHELL=/bin/bash
TMPDIR=/var/folders/c3/rfxqqg_n7sh9gc2f44mqdxt80000gr/T/
USER=jdoe
PATH=/usr/bin:/usr/sbin:/bin:/sbin
PWD=/Users/jdoe/.local/macenv/env/myenv
SHLVL=1
HOME=/Users/jdoe/.local/macenv/env/myenv
_=/usr/bin/env
$ macenv rm myenv
$ macenv ls

macenv's People

Contributors

jlegarreta avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.