{"id":50766766,"url":"https://github.com/minhtuannguyen/mac_sandbox","last_synced_at":"2026-06-11T14:30:24.166Z","repository":{"id":362246988,"uuid":"1257574601","full_name":"minhtuannguyen/mac_sandbox","owner":"minhtuannguyen","description":"Generic macOS sandbox wrapper for CLI tools.","archived":false,"fork":false,"pushed_at":"2026-06-03T08:31:55.000Z","size":13,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-03T10:17:33.865Z","etag":null,"topics":["ai","macos","opencode","sandbox"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/minhtuannguyen.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-06-02T20:09:31.000Z","updated_at":"2026-06-03T08:31:59.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/minhtuannguyen/mac_sandbox","commit_stats":null,"previous_names":["minhtuannguyen/mac_sandbox"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/minhtuannguyen/mac_sandbox","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/minhtuannguyen%2Fmac_sandbox","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/minhtuannguyen%2Fmac_sandbox/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/minhtuannguyen%2Fmac_sandbox/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/minhtuannguyen%2Fmac_sandbox/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/minhtuannguyen","download_url":"https://codeload.github.com/minhtuannguyen/mac_sandbox/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/minhtuannguyen%2Fmac_sandbox/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34204177,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-11T02:00:06.485Z","response_time":57,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","macos","opencode","sandbox"],"created_at":"2026-06-11T14:30:23.034Z","updated_at":"2026-06-11T14:30:24.160Z","avatar_url":"https://github.com/minhtuannguyen.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# mac-sandbox\n\nGeneric macOS sandbox wrapper for CLI tools. Enforces OS-level file write restrictions via `sandbox-exec`. Works with any CLI program — defaults to [OpenCode](https://opencode.ai).\n\n## Install (OpenCode — default)\n\n```bash\ncurl -fsSL https://raw.githubusercontent.com/minhtuannguyen/mac_sandbox/main/install.sh | bash\n```\n\nInstalls `opencode-sandbox` to `~/.local/bin/` and creates `~/.config/mac-sandbox/opencode.json`.\n\n## Install for another app\n\n```bash\ncurl -fsSL https://raw.githubusercontent.com/minhtuannguyen/mac_sandbox/main/install.sh | bash -s -- --app claude\n```\n\nInstalls `claude-sandbox` to `~/.local/bin/` and creates `~/.config/mac-sandbox/claude.json`.\n\nSafe to re-run — updates the wrapper if a newer version is available, never overwrites your config.\n\n## Configuration\n\nEach app has its own config at **`~/.config/mac-sandbox/\u003capp\u003e.json`** (created on first install).\n\n```json\n{\n  \"$schema\": \"https://raw.githubusercontent.com/minhtuannguyen/mac_sandbox/main/schema.json\",\n  \"sandbox_enabled\": true,\n  \"allowed_directories\": [\n    \"~/repositories/**\"\n  ],\n  \"state_dirs\": [\n    \"~/.config/opencode/\",\n    \"~/.local/share/opencode/\",\n    \"~/.local/state/opencode/\"\n  ],\n  \"network\": \"full\",\n  \"process_spawning\": \"allowed\"\n}\n```\n\n### Key fields\n\n| Field | Purpose |\n|-------|---------|\n| `allowed_directories` | Paths the app may write to — your project directories. `**` glob supported. |\n| `state_dirs` | Directories the app uses for its own config/data/state. Always writable inside the sandbox. |\n| `program` | Override the binary name if it differs from the alias (e.g. `opencode-nightly`). |\n| `sandbox_enabled` | Set to `false` to bypass the sandbox entirely (useful for debugging). |\n| `temp_allowed` | Allow `/tmp` and `/var/tmp` writes (default: `true`). |\n| `network` | `\"full\"` or `\"none\"` (default: `\"full\"`). |\n| `process_spawning` | `\"allowed\"` or `\"denied\"` (default: `\"allowed\"`). |\n| `deny_privilege_escalation` | Block `setuid`/capability changes (default: `true`). |\n\n## How it works\n\n```\nopencode (alias)\n  └─▶ opencode-sandbox        ← installed to ~/.local/bin/\n        │  (mac-sandbox wrapper, app = inferred from filename)\n        ├─ reads ~/.config/mac-sandbox/opencode.json\n        ├─ generates a temporary .sb profile in /tmp\n        ├─ launches: sandbox-exec -f profile.sb opencode\n        └─ cleans up the .sb file on exit\n```\n\nThe app name is inferred from the wrapper's own filename by stripping `-sandbox`:\n`opencode-sandbox` → `opencode`, `claude-sandbox` → `claude`.\n\nThe sandbox uses a **deny-by-default** approach:\n- `(deny default)` — block everything except explicitly allowed operations\n- `(allow file-read*)` — allow reads everywhere (only write access is restricted)\n- `(allow file-write*)` — re-open writes **only** for `allowed_directories`, `state_dirs`, and `/tmp`\n- `(allow process-fork/exec*)` — only if `process_spawning: \"allowed\"`\n- `(allow network*)` — only if `network: \"full\"`\n\nThe wrapper is stateless: it generates a fresh `.sb` profile on each run and deletes it on exit.\n\n## Updating\n\nRe-run the same install command:\n\n```bash\ncurl -fsSL https://raw.githubusercontent.com/minhtuannguyen/mac_sandbox/main/install.sh | bash\n```\n\nThe installer checksums the installed wrapper against the remote version and replaces it only if it changed. Your `~/.config/mac-sandbox/\u003capp\u003e.json` is always preserved.\n\n## Limitations \u0026 Notes\n\n### `sandbox-exec` deprecation\n\n`sandbox-exec` is deprecated in macOS and may be removed in a future version. If Apple removes it, the wrapper will fall back to direct execution: `exec \"$APP_BIN\" \"$@\"`.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fminhtuannguyen%2Fmac_sandbox","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fminhtuannguyen%2Fmac_sandbox","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fminhtuannguyen%2Fmac_sandbox/lists"}