Sandbox sets TMPDIR but doesn't create the directory
Resolved 💬 3 comments Opened Feb 20, 2026 by Jython1415 Closed Feb 20, 2026
Bug
The sandbox sets TMPDIR=/tmp/claude in the subprocess environment, but does not create the /tmp/claude directory. On macOS, /tmp is cleared periodically by the system, so this directory vanishes between sessions.
This causes any tool that creates temp files to fail:
$ uv run ruff check .
error: No such file or directory (os error 2) at path "/tmp/claude/.tmphGWqIr"
Also affects pytest, uv run generally, and anything else that respects TMPDIR.
Expected behavior
If the sandbox sets TMPDIR, it should ensure the directory exists (e.g., mkdir -p $TMPDIR before launching the subprocess).
Workaround
mkdir -p /tmp/claude at the start of a session, or prefix commands with TMPDIR=/private/tmp/claude-502.
Environment
- macOS 15 (Darwin 25.2.0)
- Claude Code CLI
---
Created with assistance from Claude Code
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗