Sandbox
A sandbox is an isolated space in which a program runs with limited access to the rest of the computer. In Claude Code, the sandbox is a boundary enforced by the operating system around the terminal commands Claude runs: you decide which files they can change and which websites they can connect to. It works on macOS, Linux and WSL2 and is off by default.
An isolated space in which a program can do what it likes without touching the rest of the computer, like a sandbox for children.
How it shows up in Claude Code
You turn it on by typing /sandbox in a conversation or by setting sandbox.enabled to true in settings.json. On macOS it uses a mechanism built into the system; on Linux and WSL2 it needs the bubblewrap and socat programs, and the /sandbox panel tells you if they’re missing. By default, sandboxed commands can write only to the project folder and a temporary folder, and internet connections go through a filter with a list of allowed sites that starts out empty. Because the operating system enforces the limits, Claude Code can run sandboxed commands without asking you each time.
Example
You turn the sandbox on:
/sandbox
Then you ask Claude to run the tests. They run without prompts, because they only work inside the project folder. If a command tried to write to your home folder, the system would stop it with “Operation not permitted”.
Common mistakes
- Thinking the sandbox covers everything. It covers terminal commands only. Claude’s reading and editing tools, hooks and local MCP servers run outside it and follow permissions instead.
- Reading isn’t blocked by default. Sandboxed commands can read most of the computer; secret files have to be blocked separately with read settings.
- Accepting “retry without the sandbox” on reflex. When a command fails, Claude may ask to run it unsandboxed. Read what it wants to do first.
- Windows without WSL2. On native Windows, commands run unsandboxed.
Related terms and where you learn it
The sandbox complements permissions and deny rules; for full isolation there’s a container. You configure it in settings.json. You meet it in the lesson “How are the rules written?” in module 03, Permissions: what Claude may do.
Source: Claude Code documentation: Configure the sandboxed Bash tool
How it appears in the course
Codex works on its own only inside a “sandbox”: the project folder, with no internet.
Introduction · Module 05, Permissions and safety
Now I'll show you the boundary within which Codex works on its own: the sandbox.
What is the sandbox? · Module 05, Permissions and safety
Full access removes both the sandbox and the approvals.
Why do you avoid Full access? · Module 05, Permissions and safety
Learn Claude Code from zero, in plain English
12 modules with 1–2 minute lessons, which you can also do on your phone. The first two modules are free.