[BUG] "operation not permitted: /tmp/claude-501/cwd-*" error on macOS in sandbox mode
Resolved 💬 8 comments Opened Jan 29, 2026 by monsterhxw Closed Feb 16, 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?
When executing any Bash command in Claude Code CLI with sandbox mode enabled, a permission error appears before the actual command output:
zsh:1: operation not permitted: /tmp/claude-501/cwd-dd16
The error occurs on every Bash command execution. The underlying commands still work, but the error message is always present.j
What Should Happen?
Commands should execute without permission errors. The temporary directory operations in /tmp/claude-501/ should work seamlessly.
Error Messages/Logs
$ git status
zsh:1: operation not permitted: /tmp/claude-501/cwd-99da
On branch main
Your branch is up to date with 'origin/main'.
...
> The error consistently references `/tmp/claude-501/cwd-*` with varying suffixes (dd16, 99da, 860e, etc.).
Steps to Reproduce
- Install Claude Code CLI (
claude) - Enable sandbox mode in
~/.claude/settings.json:
``json``
{
"sandbox": {
"autoAllowBashIfSandboxed": true,
"enabled": true
}
}
- Run
claudeto start a session - Execute any Bash command, for example:
- Use
/commit-commands:commitslash command (See: https://github.com/anthropics/claude-code/tree/main/plugins/commit-commands) - Or run
git status
- Observe the error message
zsh:1: operation not permitted: /tmp/claude-501/cwd-*appearing before the command output
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
2.1.21 (Claude Code)
Claude Code Version
2.1.23 (Claude Code)
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Other
Additional Information
- Using Claude Code CLI
- Sandbox mode enabled via
~/.claude/settings.json - The error appears to be related to Claude Code's internal handling of temporary working directory files in sandbox mode
- The actual commands still execute successfully despite the error
- This may be related to sandbox mode's interaction with
/tmpdirectory operations on macOS - The issue affects all Bash command executions, not just specific commands
This issue has 8 comments on GitHub. Read the full discussion on GitHub ↗