Task agent fails on Termux: EACCES permission denied for /tmp/claude
Description
Task agents fail on Termux (Android) because Claude Code tries to create directories under /tmp/claude/, which doesn't exist on Termux and cannot be created without root.
Error
EACCES: permission denied, mkdir '/tmp/claude/-data-data-com-termux-files-home-donna/tasks'
Environment
- Platform: Android (Termux)
- Claude Code version: Latest from npm
Expected Behavior
Claude Code should respect $TMPDIR environment variable or use a fallback temp directory that works on Termux.
Termux Context
Termux uses /data/data/com.termux/files/usr/tmp as its temp directory. The standard /tmp doesn't exist and requires root to create.
Suggested Fix
Use $TMPDIR if set, falling back to /tmp only if $TMPDIR is not defined.
const tmpBase = process.env.TMPDIR || '/tmp';
Workaround Attempted
Setting TMPDIR in .bashrc does not resolve the issue, suggesting the path is hardcoded.
Having same issue as well on v2.1.1
Workaround Found
Until this is fixed upstream, you can use proot to bind Termux's temp directory to /tmp:
proot -b "$TMPDIR:/tmp" claude
Setup
-
Install proot (if not already):
pkg install proot -
Create a wrapper script or alias:
alias claude='proot -b "$TMPDIR:/tmp" claude'Or for project-specific aliases:
alias myproject='cd ~/myproject && proot -b $TMPDIR:/tmp claude --dangerously-skip-permissions'
How it works
proot intercepts filesystem calls and redirects /tmp to Termux's actual temp directory ($TMPDIR, typically /data/data/com.termux/files/usr/tmp). Claude Code sees /tmp as expected, but writes actually go to the Termux-accessible location.
Verified working
- Task agents now spawn correctly
- No noticeable performance impact
- Full file access preserved (proot only binds the one path)
Hope this helps other Termux users while waiting for a proper fix.
### This works, thank you!
export CLAUDE_CODE_TMPDIR=$HOME/tmp/claude
source ~/.bashrc
Just tested this on Termux, works perfectly.
Agents spawn fine now. Much cleaner than the proot wrapper I was using before.
Thanks @HEYANGLI23
Confirming: TMPDIR workaround does NOT work
Your observation is correct - setting TMPDIR in .bashrc or .profile does not resolve the issue.
My Configuration
# ~/.profile
export TMPDIR="$HOME/.cache/tmp"
export CLAUDE_CODE_TMPDIR="$HOME/.claude-tmp"
Both directories exist and are writable. Claude Code ignores both.
Evidence
Error still shows hardcoded path:
EACCES: permission denied, mkdir '/tmp/claude/-data-data-com-termux-files-home/tasks'
Environment
- Node.js v24.13.0, npm 11.8.0
- Termux on Android 13
Only Working Workaround
From issue #15628 - proot bind mount:
proot -b /data/data/com.termux/files/usr/tmp:/tmp claude
The suggested fix in your issue is correct:
const tmpBase = process.env.TMPDIR || '/tmp';
This is a simple one-line fix. 8+ duplicate issues remain open since December 2025.
Tested on Termux (TalkBack user)
Closing for now — inactive for too long. Please open a new issue if this is still relevant.
Workaround: https://github.com/anthropics/claude-code/pull/31701#issuecomment-4017294725
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.