Skip to content

Instantly share code, notes, and snippets.

@eas4ai
Created July 10, 2026 00:10
Show Gist options
  • Select an option

  • Save eas4ai/b4459b1811f332625ded0f4e4f890c3b to your computer and use it in GitHub Desktop.

Select an option

Save eas4ai/b4459b1811f332625ded0f4e4f890c3b to your computer and use it in GitHub Desktop.
Sandbox Mac
sandbox() {
local name="${1:?Usage: sandbox <name>}"
local workspace="$HOME/workspace/$name"
mkdir -p "$workspace"
# Note - sandbox-exec is deprecated on Macs
sandbox-exec -p "
(version 1)
(deny default)
(allow process-exec)
(allow process-fork)
(allow sysctl-read)
(allow mach-lookup)
(allow signal)
(allow file-read*)
(allow file-write* (subpath \"$workspace\"))
(allow file-write* (subpath \"/private/tmp\"))
(allow file-write* (subpath \"/dev/tty\"))
(allow file-write* (subpath \"/dev/null\"))
" bash --rcfile "$HOME/.bashrc"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment