2.8 KiB
05 — Claude Code on Termux
The reason this whole repo exists. Two non-obvious things break Claude Code on Termux:
- Version ceiling: v2.1.112. Starting v2.1.113, the CLI ships as a native binary (SEA) for
linux-x64,linux-arm64-glibc,linux-arm64-musl,darwin-*,win32-*. Termux'sprocess.platform === 'android'is not in that list. Even--force-installing thelinux-arm64package fails because the binary needs/lib/ld-linux-aarch64.so.1or/lib/ld-musl-aarch64.so.1, neither of which exist in Bionic libc. /tmpis hardcoded. Claude Code writes to/tmp/claude/...for background tasks. Termux doesn't have a writable/tmp.termux-chrootexposes/tmp -> /usr/tmpto all child processes (whichproot -balone does not).
Install
If you just want it working, run the top-level installer:
bash install.sh
Otherwise, the manual steps are:
# 1. Pin to the last compatible version
npm install -g @anthropic-ai/claude-code@2.1.112
# 2. Protect against the auto-updater (it can ignore env vars)
chmod -R a-w $PREFIX/lib/node_modules/@anthropic-ai/claude-code/
# 3. Make the wrapper available
cp bin/clauded ~/.local/bin/
chmod +x ~/.local/bin/clauded
Settings
~/.claude/settings.json:
{
"env": { "DISABLE_AUTOUPDATER": "1" },
"skipDangerousModePermissionPrompt": true,
"effortLevel": "xhigh"
}
DISABLE_AUTOUPDATER is also exported from bashrc.snippet. Belt and suspenders — the auto-updater has been observed to ignore the env var in some releases, which is why chmod -R a-w is the real defense.
How clauded works
clauded
└── termux-chroot
└── claude --dangerously-skip-permissions "$@"
termux-chroot simulates a Linux FHS where /tmp, /etc, /usr etc. point to their Termux equivalents. Crucially, every child process inherits this view, so any background task Claude spawns also sees a working /tmp.
Updating safely
claude-update
This script:
- Checks npm for the latest version.
- Compares against the ceiling (
2.1.112). - Refuses to upgrade past the ceiling.
- Reapplies
chmod -R a-wafter a successful install.
If a future Anthropic release re-supports Android (or restores the pure-Node fallback), bump the ceiling in claude-update and the README.
Authenticating
clauded
# Inside Claude: /login
Subscription accounts and API keys both work. The OAuth flow opens a URL; long-press to copy it on Android and paste it in a real browser (Chromium, Firefox).
When the wheels come off
See TROUBLESHOOTING.md for:
EACCES: /tmp/claude/...native binary not installedclaude --versionworks butclaudederrors- Sharp / image support
proot-distroescape hatch (lets you run newer versions inside a real glibc rootfs)