[BUG] Claude Code uses Linux sandbox (bwrap) instead of macOS Seatbelt when bwrap is installed via Homebrew (Apple Silicon, v2.1.71)
Status Fixed / completed
Maintainer reply None cached
Workaround ✓ Mentioned in thread ↓
Activity 4 comments · opened Mar 9, 2026 · closed Mar 9, 2026
Description
On macOS Apple Silicon, if bubblewrap and socat are installed via Homebrew,
Claude Code detects them on $PATH and switches to the Linux sandbox code path
instead of using macOS Seatbelt. Since bwrap does not work on macOS, sandbox
initialization fails silently: the /sandbox menu shows only a "Dependencies"
tab with no mode selection, and sandbox cannot be enabled.
Steps to Reproduce
- Install bwrap and socat via Homebrew on macOS Apple Silicon
- Run Claude Code v2.1.71
- Type
/sandbox
Expected Behavior
On macOS, Claude Code should always use Seatbelt regardless of whether bwrap
is installed. The /sandbox menu should show mode selection tabs.
Actual Behavior
/sandboxshows only a "Dependencies" tab, listing Linux deps as "installed":- bubblewrap (bwrap): installed
- socat: installed
- seccomp filter: installed
- No mode selection tabs appear
"sandbox": { "enabled": true }in settings.json has no effect- Sandbox remains permanently disabled
Root Cause Hypothesis
Platform detection for sandbox backend appears to check for bwrap on $PATH
rather than checking the OS first. When bwrap is present (via Homebrew), the
Linux code path is selected even on macOS.
Environment
- OS: macOS 15.7.3 (24G419), Apple Silicon (arm64)
- Claude Code: v2.1.71
- bwrap/socat installed via Homebrew
Related
- #19996: Same bwrap-on-macOS issue for Cowork (resolved, but root cause
persists in regular Claude Code)
4 Comments
Found 2 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
Update: Root Cause Identified
The actual cause was missing ripgrep (
rg) binary, not bwrap platform detection as initially hypothesized./doctorrevealed:ripgrep (rg) not foundOn this system,
rgexists only as a shell function shim pointing to Claude Code itself — not as a standalone binary. The sandbox initialization requires the realrgbinary, which is not available to subprocesses.Fix:
brew install ripgrepresolved the issue immediately.Revised Root Cause
The
/sandboxmenu was misleading: it showed bwrap/socat/seccomp as "installed" (hiding the real missing dependency), with no indication that ripgrep was also required and missing. The "Dependencies" tab never surfaced the ripgrep failure, and the mode selection tabs never appeared as a result.The
/doctorcommand was what finally surfaced the actual missing dependency.Suggestion
The
/sandboxDependencies tab should list ripgrep alongside bwrap/socat/seccomp, and ideally show a clear failure state with the missing dependency name rather than silently showing no mode selection.Duplicate of #31804 (confirmed v2.1.71 regression). Workaround and root cause details have been posted there.
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.