Security

2026 Which Claude Code Tasks Can’t Rely Only on macOS Sandbox?

Best choice: keep supervised builds and tests in Claude Code’s built-in macOS Sandbox, but move MCP, Hooks, unattended execution, and untrusted repositories into Sandbox Runtime or a separate virtualized Mac. Handwritten SBPL can add experimental controls, but it should not be the only security baseline for a team.

This article is for:

  • Individual developers deciding whether a Claude Code task should remain on a primary Mac.
  • DevSecOps engineers assessing process, credential, and network exposure beyond Bash.
  • Engineering platform owners defining when local execution must give way to a controlled environment.

Last updated September 9, 2026. Current behavior and support notes were checked against the Claude Code documentation, Sandbox Runtime repository, Apple platform documentation, and the sandbox-exec manual page.

Start with the task, not the tool

The same Claude Code session can contain very different risk levels. A supervised test run against a trusted repository is not equivalent to an unattended task with MCP access, hooks, package installation, and network credentials.

Claude Code’s built-in macOS Sandbox uses macOS Seatbelt capabilities to constrain Bash commands and their child processes. The official CLI documentation describes its sandboxing model and the permission prompts that remain part of the workflow. Those controls are useful for limiting ordinary file and network activity, but they do not automatically mean that every process participating in the session shares the same boundary. See the Claude Code CLI reference for the current documented behavior.

The key decision is therefore not “sandbox or no sandbox.” It is:

  • What can the agent write?
  • Which processes can it start?
  • Which processes can start outside the Bash boundary?
  • Which credentials can those processes read?
  • Can the environment be reset after a failed or malicious task?
  • Is a person watching every approval?

Decision conditions

Use the following branches before selecting an environment:

  • If the code is trusted, the developer reviews every command, and the task stays inside a disposable or well-scoped workspace, choose the built-in macOS Sandbox first.
  • If MCP servers, Hooks, browser tools, credential helpers, or external service integrations are involved, evaluate full-process isolation through Sandbox Runtime or an outer environment.
  • If the task runs unattended, assume approval prompts are unavailable as a final defense and move to a stronger boundary.
  • If the repository or install script is unfamiliar, use a resettable virtual machine, isolated Mac environment, or another complete operating-system boundary.
  • If a team needs a repeatable policy, do not rely on each developer’s handwritten SBPL profile. Standardize the image, writable paths, credentials, network policy, and reset process instead.

This makes Claude Code macOS Sandbox a starting point for selected work, not a universal answer.

First step: keep supervised development inside the local boundary

Daily development can remain on the primary Mac when the operator is actively reviewing the work and the repository has a trustworthy origin. Typical examples include compiling a known project, running unit tests, editing application files in a designated workspace, and generating documentation without access to production credentials.

The benefit is operational simplicity. The developer keeps the existing toolchain, local editor, signing setup, and hardware access. There is no need to rebuild the environment for every ordinary change.

The security benefit comes from combining two separate layers:

  1. Permission prompts decide whether Claude Code may perform a requested class of action.
  2. The operating-system sandbox limits what an approved command can access.

Approving a command does not grant it unlimited authority over the Mac. Conversely, a sandbox rule does not make careless approval safe. A command can still damage files that are inside its permitted writable area, consume credentials available to the process, or create a confusing state in the project.

Task pattern Local macOS Sandbox Main residual concern Recommended decision
Build and test a trusted repository Usually suitable Workspace damage or test-side effects Stay local with supervision
Edit files in a scoped project directory Usually suitable Excessive writable paths Keep writes narrowly scoped
Install an unfamiliar dependency Weak fit Installer scripts and network activity Move to a disposable environment
Use MCP with external credentials Incomplete by itself Separate server process and credential exposure Evaluate full-process isolation
Run for a long period without review Poor fit No human approval at the moment of action Use an isolated environment

A practical local setup should use a separate working directory, synthetic credentials, and a recoverable repository. It should also avoid mounting sensitive directories merely because a build tool expects them to exist.

The Apple App Sandbox documentation explains the broader macOS sandbox model, but Claude Code’s command-line workflow should not be treated as identical to a signed App Store application. The relevant question is which processes, paths, and network operations the current Claude Code environment actually constrains.

Second step: treat MCP and Hooks as separate process risks

Can Claude Code’s built-in sandbox also restrict MCP servers and Hooks? Not automatically in the same way as Bash commands. The safe assumption is that an MCP server or Hook may run as an independent process with its own file, network, and credential access unless the chosen environment explicitly places the full process tree behind the same boundary.

This distinction is easy to miss. A developer may see a denied file access from a Bash command and conclude that the entire session is isolated. However, an MCP server can be started through a different mechanism, while a Hook can execute at a lifecycle event and call local tools or services. The exposure may include:

  • API keys stored in environment variables.
  • SSH agents, cloud credential helpers, or local configuration files.
  • Network access to external services.
  • Tool-specific caches and temporary files.
  • A larger set of child processes than the original Bash command.

The built-in sandbox is therefore appropriate when the intended control is specifically “limit Bash and its ordinary child commands.” It is not enough when the requirement is “contain every process participating in this Claude Code session.”

The Sandbox Runtime repository is the relevant reference point for evaluating a broader runtime approach. It should be assessed against the exact MCP and Hook architecture in use, rather than assumed to provide identical behavior for every integration.

Control layer Primary scope What it helps contain What still needs review
Permission prompts Requested actions Human approval workflow Human availability and judgment
Claude Code Bash Sandbox Bash commands and related execution paths File and network operations within its documented scope MCP, Hooks, credential helpers, and integration processes
Sandbox Runtime A broader execution environment, depending on deployment Process and resource boundaries around the selected workload Runtime configuration and integration compatibility
Virtualized Mac Guest operating system Guest files, tools, processes, and reset state Host integration, shared folders, credentials, and network exits

A useful review method is to draw the process tree before choosing a control. Start with Claude Code, then list Bash, MCP servers, Hooks, package managers, compilers, browser helpers, credential agents, and any remote service clients. If a process is not clearly inside the selected boundary, treat it as outside until verified.

Third step: remove approval prompts from the threat model for unattended work

Does Claude Code need a virtual machine for unattended execution? Not every unattended job requires a traditional virtual machine, but an unattended job does require an environment whose boundary remains effective without a human approving or rejecting each action.

Automation changes the security equation. In an interactive session, a suspicious delete, credential lookup, or network request may be stopped by the operator. In a long-running background task or automatic mode, the same prompt may be unavailable, ignored, or approved by a policy that is too broad.

For these jobs, the environment should provide:

  • A restricted writable filesystem.
  • Deliberately provisioned credentials.
  • A controlled network exit.
  • A clear process boundary around Claude Code and its extensions.
  • A reset or rebuild path after the run.
  • Logs that connect the agent request to the resulting command and file change.

A command allowlist alone is not sufficient. A permitted command can still operate on an overly broad directory, invoke a script, read an inherited environment variable, or pass data to a permitted network endpoint. Likewise, disabling non-sandbox warnings does not create isolation; it removes a signal that the operator might have used.

The official Virtualization framework documentation describes Apple’s supported framework for running virtual machines on Mac hardware. The Hypervisor framework documentation covers lower-level virtualization support. Neither document turns a virtual machine into a complete policy by itself. Shared folders, clipboard integration, host sockets, forwarded ports, and injected credentials can reopen the very paths the VM was intended to close.

Unattended requirement Handwritten SBPL Sandbox Runtime Virtualized Mac
Restrict selected file paths Possible Yes, subject to configuration Yes, inside the guest
Cover MCP and Hooks Must be verified per process Better candidate for full-process coverage Stronger default boundary if integrations stay in the guest
Reset after a failed run External workflow required Depends on deployment Natural fit for disposable images
Preserve native host tools Strong Usually strong Requires guest setup
Team-wide reproducibility Low without policy management Medium to high with standard packaging High with managed images
Physical host access Broad unless separately restricted Depends on integration Must be deliberately shared

For short-lived automation, Sandbox Runtime may be a reasonable intermediate step. For high-risk jobs or jobs that must be reset repeatedly, a virtualized Mac or independent Mac environment is easier to reason about because the operating-system boundary is visible and the recovery action is explicit.

Fourth step: move unfamiliar repositories away from the primary Mac

Can an unfamiliar repository be handed directly to Claude Code for modification? It can be inspected, but direct modification and script execution on a primary Mac should not be the default when the source, dependencies, or build instructions are not trusted.

A repository is more than source code. Its package manifests, build hooks, generated scripts, test fixtures, editor tasks, and installation instructions can all influence what tools execute. Prompt injection adds another layer: text in an issue, README, fixture, or source file may attempt to redirect the agent toward credential access or unsafe actions.

A lightweight host sandbox still faces three practical limits:

  • The project itself remains writable, so a destructive operation inside the permitted directory can still damage the working copy.
  • Network access may be necessary for dependencies, but the same access can expose data or contact untrusted services.
  • Tool compatibility can encourage developers to weaken the policy until the sandbox becomes difficult to audit.

The safer workflow is to clone into a disposable location, use synthetic credentials, disable unnecessary host integrations, and run the first build in a resettable environment. Keep the repository outside the primary development checkout. Do not mount a home directory just to make a tool “work.”

Apple’s Virtualization framework reference supports the use of virtual machines where a separate operating-system environment is required. For a Mac-specific development workflow, a resettable virtualized Mac or independent Mac environment can preserve the required toolchain while separating the repository from the main workstation.

Fifth step: use SBPL as an experiment, not as the team baseline

Sandbox-exec and Sandbox Runtime are not interchangeable.

Sandbox-exec is a macOS command-line launcher that applies a Seatbelt profile, commonly written in SBPL, to a process. The sandbox-exec manual page marks the command as deprecated. It may remain usable on current systems, but that is not a promise of stable support across future macOS releases.

SBPL can express precise path and operation rules, which makes it valuable for experiments, research, and narrowly controlled local tests. It also creates maintenance obligations:

  • Rules can break when tools change their path or helper-process behavior.
  • A profile may constrain the parent process but miss an independently launched integration.
  • Developers may add broad exceptions to restore compatibility.
  • The profile source, review process, and test cases must be managed like code.
  • A working profile on one macOS release is not automatically a supported team standard on another.

Apple’s Developer Forums discussion on sandboxing should be read alongside the deprecation status rather than used as a guarantee of future compatibility.

Approach Best use Main weakness Procurement view
Handwritten SBPL Research and narrow local experiments Deprecated command and maintenance drift Do not make it the only baseline
Built-in macOS Sandbox Supervised, trusted daily work Does not automatically cover every session process Good default for low-risk local tasks
Sandbox Runtime Broader process containment Requires validation for tools and integrations Good intermediate option
Virtualized or independent Mac Untrusted, unattended, or reset-heavy work More environment management Strong choice for high-risk workflows

The distinction matters for buyers. A profile that looks technically precise can still be a poor operational control if nobody owns updates, failure handling, and compatibility testing.

Sixth step: match team policy to the risk tier

A small team can allow developers to switch isolation levels by task if the rules are short, documented, and easy to verify. The team should still define which credentials may enter a local session, which directories are writable, and what happens after a policy violation.

A regulated team needs stronger controls. It should manage configuration sources, logging, identity, network exits, image provenance, and reset procedures centrally. A virtual machine or independent Mac environment is not enough if developers can freely attach host folders or inject production credentials.

A centralized AI Agent platform has a different requirement again. It needs a standard runtime contract: approved tools, known process boundaries, disposable workspaces, credential brokering, and a clear failure-closed behavior. Local SBPL files are unlikely to provide the necessary consistency by themselves.

The following starting points are deliberately conservative:

  • Small team: local macOS Sandbox for supervised trusted work; Sandbox Runtime for MCP and Hooks; isolated environments for untrusted repositories.
  • Regulated team: managed images or independent environments for automation; centrally reviewed policies; no production secrets in local agent sessions.
  • Centralized platform: standardize the runtime and reset workflow first, then expose only approved integrations to the agent.

Teams planning a remote development workflow can review the KuzCloud environment entry point and the KuzCloud help center when assessing how a separate Mac environment would fit their delivery and reset process. The isolation policy still has to be designed by the team; environment delivery does not replace that work.

Use this migration check before each task

The following checklist gives a direct fallback path. It is more useful than choosing one isolation technology for every project.

  • [ ] The repository source is trusted and recoverable.
  • [ ] A person will review commands and meaningful file changes.
  • [ ] The task does not require MCP, Hooks, credential helpers, or broad network access.
  • [ ] The writable directory is limited to the intended workspace.
  • [ ] Credentials are synthetic, short-lived, or deliberately absent.
  • [ ] The task can be restarted without preserving host state.

If every item is checked, start with Claude Code’s built-in macOS Sandbox.

If MCP, Hooks, or external tools are required, move to Sandbox Runtime or another full-process boundary before adding credentials.

If the task is unattended, requires repeated resets, or processes unfamiliar code, use a disposable virtualized Mac or independent Mac environment.

If a team cannot explain who owns the profile, how it is tested, and how it fails closed, do not make handwritten SBPL the long-term baseline.

For developers who still run unfamiliar repositories, MCP integrations, or unattended jobs on a primary Mac, migration does not need to happen all at once. Move the highest-risk task first, prove the reset and credential workflow, then expand only after the boundary has been verified. The KuzCloud console can be reviewed as a next step for teams considering a separately delivered Mac workspace rather than rebuilding every local workflow immediately.

A primary Mac remains the most convenient option for supervised work, but it is a poor long-term boundary for untrusted code, broad integrations, and unattended execution. Renting a dedicated Mac environment through KuzCloud can offer a cleaner separation when the requirement is temporary testing, a disposable development workspace, or a controlled place to run higher-risk Claude Code tasks without weakening the developer’s main machine. For permanent heavy workloads, strict physical-device requirements, or workflows needing direct local peripherals, buying and managing dedicated hardware may still be the better choice.

Run High-Risk Development Tasks on a Dedicated Remote Mac

Move system-level builds, privileged workflows, and sensitive integrations off your daily Mac with KuzCloud.

Choose a separate macOS environment when application sandboxing cannot provide the isolation your project requires.