Skip to main content
When the sandbox blocks an operation, macOS logs the denial event through the unified logging system. Use /usr/bin/log (not shell-shadowed log) to capture and analyze these events.

Live Denial Monitoring

1

Start denial stream

Open a terminal and run the live denial filter:
This shows all sandbox denial events in real-time as they occur.
2

Run your sandboxed command

In a separate terminal, execute the safehouse-wrapped command:
3

Analyze denial output

Watch the log stream for denied operations. Each denial line follows this format:

Using the —explain Flag

The --explain flag shows effective workdir, grants, and profile selection without running a command:
Use --explain to verify which directories and integrations are active before running your command.

Log Stream Variants

Filter by process pattern

Narrow results to a specific agent or PID pattern.

Kernel-level denials

Captures low-level sandbox events from the kernel.

Recent history

Review sandboxd activity from the last 2 minutes.

Filter common noise

Excludes common macOS system noise.

Suppressing DTrace Noise

DTrace helper denials are usually harmless system noise. Suppress them with:

Converting Denials to Allow Rules

When you identify a legitimate denial, map it to the appropriate allow rule:
Always use the narrowest rule that unblocks the workflow. Prefer literal over subpath for file paths when possible.

Building a Profile from Scratch

If you’re authoring a new integration profile:
1

Start with base policy

Create a minimal .sb file:
2

Run with log stream active

Start the denial monitor in one terminal, then run your sandboxed workflow in another.
3

Map each denial to a rule

For each deny(...) event, add the minimum necessary allow rule to your profile.
4

Test full workflows

Exercise complete toolchain workflows (git, npm, cargo, etc.) since child processes inherit the sandbox policy.

Correlating with Filesystem Activity

For deeper filesystem behavior analysis, combine sandbox logs with fs_usage:
Replace <pid> with the process ID from the denial log.

Common Issues

Nested sandbox failure

Symptom: sandbox-exec cannot nest errorCause: Already running inside a sandboxFix: Run from an unsandboxed terminal session

Git operations blocked

Symptom: git commands fail with permission errorsCause: Missing workdir grant or git integration not enabledFix: Verify workdir with --explain, ensure git integration is active

Network requests denied

Symptom: HTTP requests fail silentlyCause: Network profile not includedFix: Network is enabled by default; check for custom --append-profile overrides

Toolchain not found

Symptom: node, python, cargo not executableCause: Toolchain binary not in allowed pathsFix: Verify toolchain profile includes your installation path (see profiles/30-toolchains/)

Next Steps

Testing

Validate policy behavior with the test suite

Contributing

Submit new profiles or fixes to the project