You turn on an AI coding agent's sandbox on a Mac, and the word Seatbelt starts showing up in its settings, its error messages and its issue tracker. This post explains what it is, what it holds for an agent, and what it leaves open, from the agents' own docs and source.
What Seatbelt and sandbox-exec are
sandbox-exec ships with macOS, at /usr/bin/sandbox-exec. You give it a profile and a command, and the command runs with only what the profile allows. Every process it starts runs under the same profile, so a shell script cannot hand its work to a child process to get around it.
Profiles are written in SBPL, the sandbox profile language. An Apple engineer describes it on Apple's developer forums as a Scheme derivative that "is not documented for third-party use". A careful profile starts from refusing everything and allows things back one at a time, as the opening of Codex's base policy does:
(version 1)
; start with closed-by-default
(deny default)
; child processes inherit the policy of their parent
(allow process-exec)
(allow process-fork)
Codex also calls the tool by its full path. A comment in its Seatbelt code says it only considers sandbox-exec in /usr/bin, so that a fake one earlier on the PATH cannot stand in for it.
Which AI coding agents use it
Three agents and one standalone tool build their Mac sandbox on it. They write different profiles, so the same word means different limits:
| Tool | What runs under Seatbelt | Reads by default | Network by default |
|---|---|---|---|
Claude Code, with /sandbox on | Shell commands and their child processes | Most of the machine, including ~/.ssh | Only a local proxy, whose allowed domains start empty |
| Codex, workspace write | Commands, with writes under the writable roots | Set by its sandbox policy | Set by its sandbox policy |
Gemini CLI, with --sandbox and its default profile | Shell commands and file changes, writes confined to the project | Broad | Allowed |
| Anthropic's sandbox runtime | Any process you wrap, a whole agent included | Set in its config | Only a local proxy |
Claude Code's sandbox is off until you run /sandbox or set sandbox.enabled, according to Anthropic's page on the sandboxed Bash tool. Gemini CLI's sandbox docs list six built-in profiles; the default allows the network and broad reads, and the strict ones restrict reads too. Codex's core README says its profile keeps .git and .codex read-only even inside a writable workspace.
What it holds
The limit sits below the agent. The model picks a command, and the operating system decides what the running process may touch, whatever the command's name says. Anthropic puts it plainly on the same page:
The operating system enforces the sandbox boundary on the running process.Claude Code docs, Configure the sandboxed Bash tool
That matters because the dangerous command rarely looks dangerous. A test script, a package install step or a build tool can read a file or open a connection that nobody asked for. A rule that matches command text does not see that; a profile on the process does.
The network is handled with a proxy. The sandbox runtime's README says its Seatbelt profile allows traffic only to one localhost port, where a proxy outside the sandbox checks each hostname against the allowed list. Our notes on whether Claude Code can access the internet cover what that list does and does not stop. On macOS the runtime can also read the system's log of sandbox violations, so a refused action shows up as a record and not only as a failed command.
Where it stops
Only what starts inside it. Claude Code's Seatbelt profile wraps shell commands. Its own file tools, hooks and local MCP servers run outside with your full access, and the docs say a denyRead entry does not stop the Read tool. Our post on read deny rules in Claude Code covers that second layer.
Reads you did not narrow. By default Claude Code's sandboxed commands can read credential files such as ~/.ssh and ~/.aws/credentials, and they inherit the environment variables Claude Code started with, secrets included. Gemini CLI's default profile allows broad reads and the open network. A sandbox that can read your keys and reach the internet is one bad instruction from sending them, which is the pattern our list of AI agent security risks starts with.
Holes the settings open. Anthropic's limitations section names them. Allowing Apple Events "removes code-execution isolation", because a sandboxed command can then launch other apps outside the sandbox. Each Mach or XPC service you allow is reached from inside without limits on what it does. Allowing the Docker socket hands over the host. Writes to a shell file such as .zshrc or to a folder on the PATH can run code later, outside the sandbox, when something else reads it.
Hostnames, not contents. The proxy decides from the name the client gives and does not inspect encrypted traffic by default. Anthropic warns that allowing a broad domain such as github.com can open a path for data to leave, and that code inside can potentially use domain fronting to reach hosts outside the list.
Deprecated, and undocumented
Apple deprecated sandbox-exec years ago. On the forum thread above, in 2020, the same Apple engineer gives the reason: there is little use in a sandbox with no supported way to describe it. What Apple supports is the App Sandbox, which an app declares with entitlements and which Mac App Store apps must use. An agent's shell command is not an app with entitlements, so that route does not fit, and SBPL stays the only way to write a custom profile.
On SBPL the engineer is blunter, saying "it would be unwise to build a product based on it." Every agent in the table did anyway, because it is the sandbox a Mac has without a virtual machine.
The practical risk is change without a contract. A macOS update can alter what a profile allows or breaks, and there is no documented behavior to hold it to. Pin your agent version, and recheck its sandbox after a major macOS upgrade.
"Seatbelt is deprecated, so it is broken."
Revision 1: it still runs and still refuses. Deprecated means unsupported, and the profile decides what it refuses.The other option on a Mac: a container or a VM
Anthropic's guide to choosing a sandbox environment splits the options in two. The Bash sandbox and the sandbox runtime run on macOS itself, with Seatbelt. Dev containers, custom containers and virtual machines such as microVMs run the agent on another kernel, a Linux one on a Mac, and cover the whole process, its file tools and helpers included.
The runtime sits between them: it wraps the entire Claude Code process in the same Seatbelt isolation, and Anthropic calls it a beta research preview. Gemini CLI offers Docker and Podman beside Seatbelt. A container or VM costs setup and some speed; in return it does not depend on an undocumented macOS language, and the agent reaches only the folders you mount into it.
How to check what yours allows
Read the resolved settings. In Claude Code, the Config tab of /sandbox shows what the sandbox will enforce. In Gemini CLI, the SEATBELT_PROFILE variable names the profile in use.
Narrow the reads. Add denyRead entries for ~/.ssh, ~/.aws and the folders that hold your tokens, or pick a strict profile in Gemini CLI. Keep secrets out of the environment the agent starts with.
Close the fallbacks. Turn off the retry that lets a failed command run unsandboxed, keep Apple Events off, and allow no Docker socket. In bypass permissions mode that retry runs without asking anyone, so the sandbox is only as strict as its way out.
Test it. Ask the agent to read a file under ~/.ssh and to fetch a host you did not allow. Both should fail. If either works, the profile is not the one you think it is.
A side note on how we do it
We build Fenzi, which on a Mac does not use Seatbelt: it starts the agent in an OpenShell sandbox inside a Linux VM, where the rules apply to the VM's kernel and cover the whole agent, as the platforms table on the install sheet shows. A container or VM you set up yourself, or a well-narrowed Seatbelt profile, can answer the same question.
So, should you rely on it?
Seatbelt is a real limit enforced by the operating system, and it is better than an agent that runs as you with no sandbox at all. What it protects is whatever the profile says, and the defaults are written so that work does not break, not so that keys stay put. Narrow the reads, close the fallbacks and test the refusals, or move the agent into a container or VM when the whole process needs one boundary. Anthropic's sandboxed Bash tool page, and its limitations section in particular, is the best next read for any Seatbelt-based agent.