project-claude-code-termux.md 2.02 KB

name: claude-code-termux-setup description: "Claude Code CLI runs inside Ubuntu proot-distro container on Android Termux, configured with Kimi Coding Plan" metadata: node_type: memory type: project

originSessionId: a0bf5811-73e6-4c69-beeb-9a2867ab56bf

Why: Claude Code binary is ELF/glibc compiled and cannot run directly on Android (Bionic libc). Solution is running it inside an Ubuntu proot-distro container.

Wrapper script: /data/data/com.termux/files/usr/bin/claude-run

#!/data/data/com.termux/files/usr/bin/sh
exec proot-distro login --shared-home ubuntu -- claude "$@"

Key flag: --shared-home binds Termux home (/data/data/com.termux/files/home) as /root inside the container. Without this flag, Ubuntu's /root is isolated and Claude Code cannot access Termux project files.

Claude Code config (inside Ubuntu container):

  • Path: /root/.claude/settings.json
  • Kimi Coding Plan configuration: json { "env": { "ANTHROPIC_AUTH_TOKEN": "sk-kimi-UkxAkZTnTK5dBxl6zjVFkiHJg3vubzNj3xbOk55aVKfIlDpYKUhDcUB80hWJOtZQ", "ANTHROPIC_BASE_URL": "https://api.kimi.com/coding/", "ANTHROPIC_DEFAULT_HAIKU_MODEL": "kimi-for-coding", "ANTHROPIC_DEFAULT_OPUS_MODEL": "kimi-for-coding", "ANTHROPIC_DEFAULT_SONNET_MODEL": "kimi-for-coding", "ANTHROPIC_MODEL": "kimi-for-coding" }, "model": "opus[1m]", "skipDangerousModePermissionPrompt": true, "theme": "dark" }

proot-distro default binds:

  • /system, /vendor, /product, /apex — Android system dirs
  • /storage, /sdcard — shared storage
  • --shared-home: Termux home → /root

What does NOT pass through by default:

  • Environment variables from Termux shell (must use --env=VAR=VALUE)
  • Other apps' /data/data/ private directories
  • Bionic-compiled Android binaries

How to apply:

  • Modify claude-run to add/remove --env flags or --shared-home
  • Modify container config via settings.json inside Ubuntu's /root/.claude/
  • Container's .bashrc and .profile are separate from Termux's