Termux workaround for running Claude Code CLI on Android.
The npm package @anthropic-ai/claude-code no longer includes a global CLI, so this guide shows how to set it up and run claude globally in Termux using an alias.
- Run Claude Code CLI from anywhere in Termux.
- Avoids the npm deprecation warning.
- Easy to update with npm.
- Termux installed on your Android device.
- Basic familiarity with terminal commands.
- Node.js and npm installed in Termux.
-
Update Termux and install dependencies ```bash pkg update -y pkg upgrade -y pkg install nodejs git -y ```
-
Install Claude Code npm library globally ```bash npm install -g @anthropic-ai/claude-code ```
-
Find your global npm path ```bash npm root -g ```
Typical path in Termux: ``` /data/data/com.termux/files/usr/lib/node_modules ```
- Test running the CLI directly ```bash node /data/data/com.termux/files/usr/lib/node_modules/@anthropic-ai/claude-code/cli.js --version ```
You should see something like: ``` 2.1.63 (Claude Code) ```
- Create a global alias
Open your shell configuration: ```bash nano ~/.bashrc # for bash
nano ~/.zshrc # for zsh ```
Add the following line at the bottom: ```bash alias claude='node /data/data/com.termux/files/usr/lib/node_modules/@anthropic-ai/claude-code/cli.js' ```
Save and exit.
-
Apply the changes ```bash source ~/.bashrc ```
-
Test the alias ```bash claude --version claude ```
You should now be able to run claude globally in Termux without seeing the deprecation warning.
To update to the latest npm version: ```bash npm install -g @anthropic-ai/claude-code ```
Verify the version: ```bash claude --version ```
- The official native installer for Claude Code does not work on Termux due to Android ABI incompatibilities.
- This alias method is the only fully functional way to run the Claude CLI in Termux as of now.
MIT License