# 05 — Claude Code on Termux The reason this whole repo exists. Two non-obvious things break Claude Code on Termux: 1. **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's `process.platform === 'android'` is not in that list. Even `--force`-installing the `linux-arm64` package fails because the binary needs `/lib/ld-linux-aarch64.so.1` or `/lib/ld-musl-aarch64.so.1`, neither of which exist in Bionic libc. 2. **`/tmp` is hardcoded.** Claude Code writes to `/tmp/claude/...` for background tasks. Termux doesn't have a writable `/tmp`. `termux-chroot` exposes `/tmp -> /usr/tmp` to **all child processes** (which `proot -b` alone does not). ## Install If you just want it working, run the top-level installer: ```bash bash install.sh ``` Otherwise, the manual steps are: ```bash # 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`: ```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 ```bash 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-w` after 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 ```bash 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 installed` - `claude --version` works but `clauded` errors - Sharp / image support - `proot-distro` escape hatch (lets you run newer versions inside a real glibc rootfs)