A self-contained, one-command installer for Claude Code on Android Termux.
Pinned to a stable version. Privacy-hardened out of the box. Fully personalised.
claude_code_setup.py is a beautiful, interactive Python script that automates the complete setup of Claude Code inside Termux (Android Linux userland).
It handles everything in 4 guided phases:
| Phase | Task |
|---|---|
| 1 | Install Node.js via pkg |
| 2 | Install Claude Code v2.1.112 via npm |
| 3 | Collect your user profile, preferences & Claude plan type interactively |
| 4 | Write hardened settings.json + personalised CLAUDE.md |
Later versions of
@anthropic-ai/claude-codeare known to break on Termux due to filesystem changes and claude code moved to x86 native architecture only. Also disabled Auto updates to prevent auto updates. This script deliberately pins to v2.1.112 β tested, confirmed stable, and production-ready on Termux.
- π¨ Beautiful TUI β colourful ASCII banner, braille spinner, phase headers
- π¦ Auto-installs Node.js if not present via
pkg - π Pinned version β no surprise breakage from upstream updates
- π€ Interactive user profiling β name, coding level, languages, device specs
- π Auto-detects ABIs, RAM, Android version from device
- π‘οΈ Privacy-first β all telemetry and non-essential traffic disabled by default
- π Hardened permissions β safe bash allowlist + dangerous command blocklist
- π Token Status Bar β live context %, 5-hour & 7-day rate-limit bars inside Claude Code
- ποΈ Clean uninstaller β double-confirm safety, removes every Claude-related file
- β Post-install verification β confirms everything is correctly set up
| Requirement | Details |
|---|---|
| Device | Any Android device running Termux |
| Android | 7.0+ recommended (tested on Android 16) |
| Termux | Latest from F-Droid (not Play Store) |
| Python | 3.x (pre-installed in Termux) β do not uninstall, required by statusline |
| Internet | Required for pkg and npm downloads |
| Storage | ~200 MB free space |
Note: Install Termux from F-Droid only. The Play Store version is Experimental and will cause issues.
1. Open Termux and update packages:
pkg update && pkg upgrade -y2. Clone this repo or download the script:
# Clone
git clone https://github.com/Graywizard888/Claude_code_setup.git
cd Claude_code_setup# OR download directly
curl -O https://raw.githubusercontent.com/Graywizard888/Claude_code_setup/main/claude_code_setup.py
3. Run the setup script:
python claude_code_setup.pyThat's it. The interactive menu takes it from here.
βββββββββββββββββββββββββββββββββββββββββββββββββ
β β
β 1 Install Claude Code β
β β Full install + personalised config β
β β Pinned to v2.1.112 (stable) β
β β
β 2 Uninstall Claude Code β
β β Complete removal β
β β Two-step confirmation β
β β
β 3 Add Settings Only β
β β Write recommended settings.json β
β β Safe to run on existing install β
β β
β 4 Enable Token Status Bar β
β β Install statusline.py β
β β Shows ctx%, 5-hour & 7-day limits β
β β
β 5 Exit β
βββββββββββββββββββββββββββββββββββββββββββββββββ
Walks you through 4 phases:
- Dependencies β Checks for Node.js, installs if missing
- Claude Code β Installs pinned
v2.1.112globally via npm - User Profile β Asks for your name, skill level, languages, device info, and Claude plan type
- Config Files β Writes
~/.claude/settings.jsonand~/.claude/CLAUDE.md
At the end, you are offered to also enable the Token Status Bar immediately.
Performs a clean, complete removal with two separate confirmation prompts (YES β UNINSTALL) to prevent accidents.
Writes (or overwrites) ~/.claude/settings.json with the latest recommended config without doing a full install. Safe to run on an existing Claude Code setup.
Installs ~/.claude/statusline.py and wires the statusLine key into settings.json. Prompts you to select your Claude plan (Pro / Max5 / Max20) so the bars show the correct token limits.
| File | Purpose |
|---|---|
~/.claude/settings.json |
Token limits, telemetry, permissions, statusLine hook |
~/.claude/CLAUDE.md |
Your personalised Claude context & behaviour rules (includes token-check instructions) |
~/.claude/statusline.py |
Token status bar script (installed by Option 1 or Option 4) |
~/.claude/statusline_cache.json |
Live token-usage cache written by statusline on each render |
{
"env": {
"DISABLE_TELEMETRY": "1",
"DISABLE_ERROR_REPORTING": "1",
"CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1",
"DISABLE_NON_ESSENTIAL_MODEL_CALLS": "1",
"MAX_THINKING_TOKENS": "10000",
"CLAUDE_CODE_MAX_OUTPUT_TOKENS": "8000",
"CLAUDE_CODE_AUTOCOMPACT_PCT_OVERRIDE": "50",
"CLAUDE_CODE_MAX_TOOL_USE_CONCURRENCY": "3",
"CLAUDE_CODE_TMPDIR": "/data/data/com.termux/files/usr/tmp",
"ANTHROPIC_SMALL_FAST_MODEL": "claude-haiku-4-5-20251001",
"CLAUDE_CODE_SUBAGENT_MODEL": "claude-haiku-4-5-20251001",
"TMPDIR": "/data/data/com.termux/files/usr/tmp",
"EDITOR": "nano",
"USE_BUILTIN_RIPGREP": "1"
},
"autoUpdates": false,
"includeCoAuthoredBy": false,
"effortLevel": "high",
"showThinkingSummaries": true,
"autoMemoryEnabled": true
}Dynamically generated from your answers + auto-detected device info. Also includes token-check rules so Claude warns you before starting heavy tasks when limits are near:
- Name: YourName
- Coding Proficiency: Beginner / Intermediate / Advanced / Expert
- Preferred Languages: python, bash, kotlin ...
- Device: OnePlus 12R IN
- Processor: Snapdragon 8 Gen 2
- ABIs: arm64-v8a, armeabi-v7a
- RAM: 7.0G
- Android: 16 (SDK 36)
- Check token usage in .claude/statusline_cache.json ...
- Warn and ask "can we continue?" if ctx/rl5/rl7 is at 75%+ ...When enabled, a live status bar appears at the bottom of Claude Code showing:
π€ Current Model claude-sonnet-4-6
π§ Chat Context ββββββββββββββββββββββββ 35.0%
β± 5-hour limit ββββββββββββββββββββββββ 10.5%
π
7-day limit ββββββββββββββββββββββββ 4.0%
Supports three plan tiers:
| Plan | 5-hour token limit |
|---|---|
pro |
44,000 |
max5 |
88,000 |
max20 |
220,000 |
β οΈ Do NOT uninstall Python from Termux βstatusline.pyrequires Python to run.
Every install applies these protections automatically:
| Setting | Status |
|---|---|
| Telemetry | β DISABLED |
| Error reporting | β DISABLED |
| Non-essential network traffic | β DISABLED |
| Auto-updates | β DISABLED |
| Co-authored-by git tag | β DISABLED |
| Non-essential model calls | β DISABLED |
grep, cat, ls, find, head, tail, wc, sort
git status, git log, git diff, git branch
node, python, python3, Read(*)
Write(*), Edit(*)
rm -rf, bash, chmod, curl, wget
WebFetch(*), WebSearch(*)
Read(.env), Read(.env.*)
Read(secrets/**), Read(**/credentials.json)
Read(**/*.pem), Read(**/*.key)
~/ (Termux home)
βββ claude_code_setup.py β this script
βββ .claude/
βββ settings.json β hardened Claude Code settings
βββ CLAUDE.md β your personalised context file
βββ statusline.py β token status bar (optional, Option 4)
βββ statusline_cache.json β live token-usage cache (auto-written)
The uninstaller removes everything:
β @anthropic-ai/claude-code (global npm package)
β ~/.claude/ (config, CLAUDE.md, statusline, history)
β ~/.claude.json (auth / account file)
β ~/.cache/claude-cli-nodejs (npm CLI cache)
β ~/.config/claude (system config)
Requires typing YES followed by UNINSTALL β no accidental removals.
# Launch Claude Code
claude
# Check installed version
claude --version
# One-shot prompt (no interactive session)
claude -p "Write a Python hello world"
# View your context file
cat ~/.claude/CLAUDE.md
# View settings
cat ~/.claude/settings.json
# View live token usage
cat ~/.claude/statusline_cache.jsonFirst launch will ask for your Anthropic API key.
Get one at console.anthropic.com
Or login via your google Claude subscription account in claude
- Go to console.anthropic.com
- Sign up / log in
- Navigate to API Keys β Create Key
- Paste it when
claudeasks on first launch
| Device | Android | Termux | Status |
|---|---|---|---|
| OnePlus 12R IN | Android 16 (SDK 36) | Latest | β Working |
| Snapdragon 8 Gen 2 | β | β | β Working |
Pull requests are welcome. For major changes, please open an issue first to discuss what you'd like to change.
- Fork the repo
- Create your branch:
git checkout -b feature/your-feature - Commit:
git commit -m "Add your feature" - Push:
git push origin feature/your-feature - Open a Pull Request
This project is licensed under the MIT License β see the LICENSE file for details.