[BUG] Sandbox blocks CoreSimulator mach-lookup, breaking iOS simulator tests

Resolved 💬 2 comments Opened Mar 20, 2026 by thoutbeckers Closed Apr 18, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

The macOS sandbox profile is missing mach-lookup entries for com.apple.CoreSimulator.CoreSimulatorService and com.apple.CoreSimulator.simdiskimaged. This prevents xcrun simctl and any build tool that runs iOS simulator tests (Kotlin/Native iosSimulatorArm64Test, Xcode xcodebuild test, etc.) from working inside the sandbox.

The ignoreViolations setting does not help — it only suppresses violation logging, the kernel still denies the mach-lookup. The only current workaround is dangerouslyDisableSandbox: true on every simulator-related command, which removes all sandbox protections.

What Should Happen?

iOS simulator tests should run inside the sandbox without requiring dangerouslyDisableSandbox: true. The two CoreSimulator mach services should be in the sandbox profile's (allow mach-lookup ...) section.

Error Messages/Logs

# kernel log when running xcrun simctl or iosSimulatorArm64Test in sandbox:
kernel: (Sandbox) deny(1) mach-lookup com.apple.CoreSimulator.CoreSimulatorService

Steps to Reproduce

  1. Have Xcode installed with iOS simulators available
  2. From Claude Code, run any command that uses the iOS simulator, e.g. a Kotlin/Native Gradle task: ./gradlew :shared:iosSimulatorArm64Test
  3. The test hangs or fails because xcrun simctl cannot communicate with CoreSimulator
  4. Same command works with dangerouslyDisableSandbox: true

Fix Confirmed

The fix was confirmed by having Claude patch the sandbox profile embedded in the binary itself. The profile's (allow mach-lookup ...) section was modified to add CoreSimulator entries using a same-length global-name-prefix replacement. After patching and re-signing, iOS simulator tests run successfully inside the sandbox.

The required additions to the mach-lookup allowlist:

(allow mach-lookup
  ...existing entries...
  (global-name "com.apple.CoreSimulator.CoreSimulatorService")
  (global-name "com.apple.CoreSimulator.simdiskimaged")
)

Ideally the sandbox settings config would also support user-configurable mach-lookup entries (as proposed in #31551), so users can unblock similar IPC-dependent tools without waiting for a release.

Is this a regression?

No, this never worked

Claude Code Version

2.1.80 (Claude Code)

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Ghostty.

Additional Information

Same class of issue as #34876 (trustd for Go TLS), #17042 (hiservices for clipboard), #26879 (configd for Rust proxy), and #31551 (feature request for configurable allowMachLookup). The sandbox mach-lookup allowlist is too restrictive for many common development workflows on macOS.

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗