Bash tool fails on Termux due to hardcoded /tmp path
Bash tool fails on Termux due to hardcoded /tmp path
Description
Claude Code's Bash tool fails to execute any commands on Termux (Android) because it attempts to create directories under /tmp/, which is not writable in Termux's sandboxed environment.
Environment
- Platform: Android (Termux)
- Shell: zsh
- Claude Code install method: npm (
/data/data/com.termux/files/usr/bin/claude)
Steps to Reproduce
- Install Termux on Android
- Install Claude Code:
npm install -g @anthropic-ai/claude-code - Launch
claudeand attempt to run any shell command via the Bash tool
Expected Behavior
Bash commands should execute successfully, using Termux's writable temp directory (typically $PREFIX/tmp or $TMPDIR).
Actual Behavior
Every Bash tool invocation fails with:
EACCES: permission denied, mkdir '/tmp/claude-10407'
Claude Code attempts to use /tmp/ which does not exist or is not writable in Termux's sandboxed Android environment.
Root Cause
Termux does not have access to /tmp. The correct temporary directory in Termux is /data/data/com.termux/files/usr/tmp (available via $PREFIX/tmp or the $TMPDIR environment variable). Claude Code appears to hardcode /tmp rather than respecting $TMPDIR or detecting the platform's temp directory.
Suggested Fix
Use $TMPDIR, os.tmpdir(), or similar platform-aware methods to resolve the temporary directory instead of hardcoding /tmp.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗