Sandbox error: zsh operation not permitted on /tmp/claude-{UID}/cwd-*

Resolved 💬 3 comments Opened Jan 31, 2026 by boldisteanu Closed Jan 31, 2026

Description

When running Bash commands in sandbox mode, a spurious error appears before each command output:

zsh:1: operation not permitted: /tmp/claude-501/cwd-0503

The commands still execute successfully, but the error is shown with "Exit code 1" which is confusing.

Environment

  • macOS (Darwin 25.2.0)
  • User shell: fish (though sandbox uses zsh)
  • Claude Code version: current

Observed Behavior

The sandbox appears to be trying to create/access a working directory symlink at /tmp/claude-{UID}/cwd-{random} but this path isn't in the allowed write list.

Looking at the sandbox config, the allowed write paths include:

  • /tmp/claude
  • /private/tmp/claude

But the actual path being accessed is /tmp/claude-501/ (where 501 is the user's UID), which doesn't match.

Expected Behavior

Either:

  1. The sandbox should allow writes to /tmp/claude-{UID}/ paths, or
  2. The sandbox should use /tmp/claude/ consistently

Reproduction

Run any Bash command in Claude Code with sandbox enabled. The error appears before the actual command output.

View original on GitHub ↗

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