[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
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

  1. Install bwrap and socat via Homebrew on macOS Apple Silicon
  2. Run Claude Code v2.1.71
  3. 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

  • /sandbox shows 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)

View original on GitHub ↗

4 Comments

github-actions[bot] · 7 months ago

Found 2 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/31804
  2. https://github.com/anthropics/claude-code/issues/25939

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

linus-ingage · 7 months ago

Update: Root Cause Identified

The actual cause was missing ripgrep (rg) binary, not bwrap platform detection as initially hypothesized.

/doctor revealed: ripgrep (rg) not found

On this system, rg exists only as a shell function shim pointing to Claude Code itself — not as a standalone binary. The sandbox initialization requires the real rg binary, which is not available to subprocesses.

Fix: brew install ripgrep resolved the issue immediately.

Revised Root Cause

The /sandbox menu 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 /doctor command was what finally surfaced the actual missing dependency.

Suggestion

The /sandbox Dependencies 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.

linus-ingage · 7 months ago

Duplicate of #31804 (confirmed v2.1.71 regression). Workaround and root cause details have been posted there.

github-actions[bot] · 7 months ago

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.