Sandbox: zsh writes to /tmp/claude-501/cwd-* causing 'operation not permitted' errors
Resolved 💬 4 comments Opened Jan 31, 2026 by kunitoku Closed Mar 3, 2026
Description
Every Bash tool invocation produces a noisy zsh:1: operation not permitted: /tmp/claude-501/cwd-XXXX error, even though the actual command succeeds. This pollutes tool output and causes misleading non-zero exit codes.
Steps to Reproduce
- Run any Bash command via Claude Code (e.g.,
git status) - Observe the error in output:
````
zsh:1: operation not permitted: /tmp/claude-501/cwd-6648
Expected Behavior
No sandbox permission errors from shell internals.
Actual Behavior
Every command produces zsh:1: operation not permitted: /tmp/claude-501/cwd-XXXX. The path changes each invocation (random suffix). The actual command executes successfully, but exit code may be affected.
Analysis
- The sandbox write allowlist includes
/tmp/claudeand/private/tmp/claude, but not/tmp/claude-501/. - Something in the shell initialization (zsh hook or prompt function) attempts to write the current working directory to
/tmp/claude-501/cwd-XXXX. - This is not caused by user zsh configuration (
~/.zshrc,~/.zprofile— confirmed clean). - The
501in the path likely corresponds to the macOS user UID.
Environment
- OS: macOS (Darwin 24.6.0)
- Shell: zsh
- Claude Code model: claude-opus-4-5-20251101
Workaround
None needed functionally — commands execute correctly. The error is cosmetic but causes confusing exit codes and noisy output.
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗