This guide walks you through A-Z installation of Claude Code on an Android device. Estimated time: 30-45 minutes (depending on download speeds).
- Prerequisites
- Install Termux
- Initial Termux Setup
- Install Runtimes (Node.js, Python, Rust)
- Install Claude Code
- Configure API Keys
- Verify Installation
- Troubleshooting
Hardware Requirements:
- Android device (Version 7.0+, recommended 10+)
- Minimum 4GB RAM (8GB+ recommended for smooth operation)
- 5GB free storage space
- USB-C or micro-USB port (for faster data transfers, optional)
- Stable WiFi connection (for initial setup and package downloads)
What You'll Need:
- F-Droid app store account (free, open-source alternative to Google Play)
- GitHub account (for pushing code)
- Anthropic API key (for Claude access)
- Get it at: https://console.anthropic.com/
- Or use other providers: Grok, DeepSeek, OpenAI
Knowledge Assumptions:
- Comfort with terminal/command-line
- Basic understanding of Linux commands
- Understanding of environment variables and
.bashrc/.zshrc
IMPORTANT: Use F-Droid, NOT Google Play Store
- Google Play version has restricted capabilities
- F-Droid version has full Linux environment access
Method A: Via F-Droid App Store (Recommended)
- Install F-Droid: https://f-droid.org/
- Open F-Droid app
- Search for "Termux"
- Install latest version (should be 0.118.0 or newer)
- Launch Termux
Method B: Manual Download
- Visit: https://github.com/termux/termux-app/releases
- Download latest
*.apkfile (e.g.,termux-v0.118.0.apk) - Enable "Unknown Sources" in Android settings
- Tap the APK to install
- Launch Termux
Termux needs access to your device storage:
termux-setup-storageThis will prompt you to allow storage access. Tap "Allow".
Verify it worked:
ls ~/storageYou should see: downloads, documents, pictures, dcim, movies, etc.
pkg update && pkg upgrade -yThis downloads and upgrades the Termux package repository. Takes 2-5 minutes depending on connection.
pkg install -y \
git \
curl \
wget \
openssh \
nano \
vim \
htop \
build-essential \
pkg-configThis gives you basic development tools.
Use Bash (default):
# Bash is already default, verify:
echo $SHELL
# Should output: /data/data/com.termux/files/usr/bin/bashOr install Zsh (more powerful):
pkg install -y zsh
chsh -s zsh
# Exit and restart Termux
exitVerify:
echo $SHELL
# Should output: /data/data/com.termux/files/usr/bin/zsh# Create important directories
mkdir -p ~/.local/bin
mkdir -p ~/.config
mkdir -p ~/projects
# Verify
ls -la ~You'll need three runtimes to work with most projects.
pkg install -y nodejs
# Verify
node --version # Should be 18+, 20+, or 22+
npm --version # Package manager for Node
npx --version # Node package executorExpected output: v24.9.0 or similar (latest stable)
pkg install -y python
# Verify
python --version # Should be 3.8+
python3 --version # Explicit Python 3
pip --version # Package manager
pip3 --version # Explicit pip3Expected output: Python 3.12.12 or newer
Rust is needed if you want to use fractal-mcp-rust or build Rust projects.
pkg install -y rust
# This may take 5-10 minutes for first installation
# Verify
rustc --version # Rust compiler
cargo --version # Rust package managerExpected output: rustc 1.90.0 or similar
Claude Code is Anthropic's CLI tool. Installation method depends on what's available:
npm install -g @anthropic-ai/claude-codeThis installs Claude Code globally (available system-wide).
Verify:
which claude-code
claude-code --version# Check if available
cargo search claude-code
# If found:
cargo install claude-code# Clone the repository
git clone https://github.com/anthropics/claude-code.git
cd claude-code
# Install dependencies
npm install
# Install globally
npm install -g .
# Verify
claude-code --versionClaude Code needs an API key to communicate with Claude.
- Get API key at: https://console.anthropic.com/
- Copy your API key (starts with
sk-ant-)
Create environment variable:
# Using your editor
nano ~/.bashrc # or ~/.zshrc if using Zsh
# Add this line at the end:
export ANTHROPIC_API_KEY="sk-ant-..."
# Save and exit (Ctrl+X, then Y, then Enter)
# Reload your shell
source ~/.bashrc # or source ~/.zshrcVerify:
echo $ANTHROPIC_API_KEY
# Should print your API key (first 7 chars visible is normal)If using alternative providers, set:
# OpenAI
export OPENAI_API_KEY="sk-..."
# DeepSeek
export DEEPSEEK_API_KEY="sk-..."
# Grok
export GROK_API_KEY="xai-..."Add to ~/.bashrc or ~/.zshrc just like above.
claude-code init
# Follow prompts to configureRun the included verification script:
bash scripts/verify.shOr manually verify each component:
# Check Termux environment
uname -a # Should show Linux, ARM64
echo $HOME # Should be /data/data/com.termux/files/home
echo $PATH # Should include /home/term/.local/bin
# Check runtimes
node --version # ≥ 18.0.0
python --version # ≥ 3.8.0
rustc --version # ≥ 1.70.0 (optional)
# Check Claude Code
which claude-code
claude-code --version
# Test API connection
claude-code --help
# Should work without errors# Simple test
echo "Hello from Termux!" | claude-code "explain this in 1 sentence"
# File operations test
echo "test content" > /tmp/test.txt
claude-code "summarize this file: /tmp/test.txt"
# System command test
claude-code "what's in my current directory?" ls
# Code analysis test (if in a git repo)
cd ~/projects/some-project
claude-code "explain the main architecture of this codebase"# Configure git identity
git config --global user.name "Your Name"
git config --global user.email "your.email@example.com"
# Generate SSH key (optional, for GitHub access)
ssh-keygen -t ed25519 -C "your.email@example.com"
# Just press Enter for all prompts to use defaults
# Display public key (copy this to GitHub)
cat ~/.ssh/id_ed25519.pubmkdir -p ~/projects
cd ~/projects
# Create your first project
mkdir my-first-project
cd my-first-project
git init
echo "# My First Project" > README.md
git add .
git commit -m "Initial commit"cd ~/projects/my-first-project
# Ask Claude Code to create a file
claude-code "create a simple hello world script in node.js"
# Ask Claude Code to modify code
echo "console.log('test')" > test.js
claude-code "refactor this code to be more readable"
# Use Claude Code for git workflows
claude-code "push my latest changes to GitHub"Cause: Claude Code not in PATH
Solution:
# Check installation
npm list -g | grep claude-code
# If not found, reinstall
npm install -g @anthropic-ai/claude-code
# Add to PATH (if needed)
echo 'export PATH=$PATH:~/.npm-global/bin' >> ~/.bashrc
source ~/.bashrcCause: File permissions issues
Solution:
# Fix permissions in home directory
chmod -R 755 ~
# For specific files
chmod 600 ~/.bashrc
chmod 600 ~/.ssh/id_ed25519Cause: API key not configured
Solution:
# Verify key is set
echo $ANTHROPIC_API_KEY
# Should show your key (or part of it)
# If empty, configure it:
nano ~/.bashrc
# Add: export ANTHROPIC_API_KEY="your-key-here"
# Save and reload: source ~/.bashrc
# Test connection
claude-code --versionCause: Storage is full
Solution:
# Check disk usage
df -h
# Clean package cache
pkg clean
# Remove old files
rm -rf ~/storage/downloads/old-downloads/*Cause: Device running out of memory
Solution:
# Check memory usage
free -h
# Close unused apps on Android
# Reduce background processes
# In Termux: Close other terminal tabs
# Consider: Restart device for full memory refreshCause: Poor internet connection
Solution:
# Verify connection
curl https://api.anthropic.com
# Should show some response (not connection error)
# Test with retry
curl --retry 3 https://api.anthropic.com
# Use faster WiFi if possibleKnown Issue: Custom slash commands don't work on Termux
Workaround:
- Use standard Claude Code commands
- See KNOWN_ISSUES.md for full list
Create a custom .bashrc configuration:
cat >> ~/.bashrc << 'EOF'
# Claude Code on Android - Custom Configuration
# Aliases for common commands
alias cl="claude-code"
alias cls="claude-code stats"
alias clh="claude-code history"
# Custom function: Quick project setup
function new-project() {
mkdir -p ~/projects/$1
cd ~/projects/$1
git init
echo "# $1" > README.md
git add .
git commit -m "Initial commit"
echo "✅ Project '$1' created in ~/projects/$1"
}
# Display useful info on startup
echo "🚀 Welcome to Claude Code on Termux!"
echo " Node: $(node --version)"
echo " Python: $(python --version)"
echo " Rust: $(rustc --version 2>/dev/null || echo 'Not installed')"
echo ""
echo "📝 Quick commands:"
echo " cl 'task' - Run Claude Code"
echo " new-project name - Create a new project"
echo ""
EOF
source ~/.bashrcAccess Termux from your computer:
# Install and start SSH server
pkg install openssh
sshd
# Display connection info
ssh-keygen -lf ~/.ssh/id_rsa.pub
# Use the displayed info to connect from computer# View mounted storage
mount | grep storage
# Symlink important directories
ln -s ~/storage/documents ~/docs
ln -s ~/storage/downloads ~/downloads# Update Termux packages monthly
pkg update && pkg upgrade -y
# Update NPM packages
npm update -g
# Update Rust
rustup update
# Update Claude Code
npm update -g @anthropic-ai/claude-code# Backup .bashrc and important configs
cp ~/.bashrc ~/storage/documents/bashrc.backup
cp ~/.gitconfig ~/storage/documents/gitconfig.backup
# Backup SSH keys (KEEP PRIVATE!)
cp -r ~/.ssh ~/storage/documents/ssh.backup
chmod 600 ~/storage/documents/ssh.backup/*- Stuck? Check KNOWN_ISSUES.md
- Found a bug? Open an issue in this repository
- Want to help? See CONTRIBUTING.md
Happy coding on your phone! 📱✨