AI coding agents are no longer limited to desktop computers.
With the right setup, you can run tools such as Claude Code directly on an Android phone using Termux. You do not need root access, a PC, or an Android emulator.

This guide shows how to set up Claude Code on Termux, explains two different installation paths, and covers some of the problems you may run into along the way.
The recommended approach uses Ubuntu inside Termux with proot-distro. It takes more storage than a native installation, but it gives the coding agent a more familiar Linux environment.
What Is an AI Coding Agent?
An AI coding agent is more than a chatbot that gives you code snippets.
A coding agent can work with files on your device, inspect an existing project, modify code, run commands, and help troubleshoot problems.
For example, instead of asking:
"How do I create a Python script that checks whether a website is online?"
you can give the agent an existing project and ask it to inspect the code, make the required changes, and test the result.
Claude Code is one example of this type of tool. There are also other CLI-based coding agents that can be used from a Linux terminal.
On Android, Termux provides the terminal environment that makes this possible.
Prerequisites
Before starting, check a few things first.
A 64-bit ARM device
Your Android operating system needs to run on aarch64.
Open Termux and run:
uname -m
You should see:
aarch64
This is important because having a 64-bit ARM processor does not always mean that Android itself is running as a 64-bit operating system.
Some older or budget Android phones, including certain Samsung A-series devices, have shipped with a 32-bit Android OS even though their hardware is capable of 64-bit operation.
If uname -m returns something such as armv7l, this setup will not work as described here.
Termux
Install Termux from a current supported source such as F-Droid or the official Termux GitHub releases.
The Google Play situation has changed over time, but the Play Store build and the main Termux project have been separate, so using the established F-Droid/GitHub sources avoids mixing incompatible builds and packages.
A Claude account
You will need access to Claude if you are using Claude Code directly.
Authentication normally happens when you first start Claude Code.
Free storage
The native route uses considerably less storage.
The Ubuntu route is heavier. Keep roughly 2 GB or more of free space available so the container and its packages have room to install properly.
Two Ways to Run Claude Code on Termux
There are two practical approaches worth knowing about.
Path A: Native Termux
The first approach runs the Linux ARM64 Claude Code binary directly through a compatibility layer in Termux.
It is attractive because the installation is smaller and you do not need an Ubuntu container.
However, this is not official Android support. Claude Code is distributed as a Linux binary, while Android uses the Bionic C library rather than the glibc environment expected by that binary.
Current community installers work around this by using tools such as glibc-runner and patching the binary's Linux interpreter.
There has also been a period where newer Claude Code releases broke older native Termux installation methods because the package moved to platform-specific native binaries.
Older guides often solved this by pinning Claude Code to version 2.1.112. Newer compatibility workarounds now exist, but the important point is that native Termux support is still a compatibility solution rather than an official Android build.
So if you see an older guide telling you to pin the Claude Code version, that advice comes from a real compatibility problem. It is not necessarily the only solution anymore.
Path B: Ubuntu with proot-distro
The second approach places Ubuntu inside Termux.
The structure looks like this:
Android
↓
Termux
↓
proot-distro
↓
Ubuntu
↓
Claude Code
proot-distro provides a Linux userland without requiring root access or a separate virtual machine.
This is the approach recommended in this guide.
The main advantage is that Claude Code sees a normal Linux environment instead of trying to operate directly against Android's userland.
It also gives you a useful Linux environment for other development tools.
There is a third option as well: Android Virtualization Framework (AVF) can provide a real Linux virtual machine on some newer devices. Current community documentation lists Pixel 6-class and newer supported devices as an experimental route. That setup is outside the scope of this guide.
Setting Up Claude Code with Ubuntu
We will now use Path B.
1. Update Termux
Start by updating your Termux packages:
pkg update && pkg upgrade -y
Then install proot-distro:
pkg install proot-distro -y
proot-distro is what we will use to install and enter Ubuntu without root access.
2. Install Ubuntu
Run:
proot-distro install ubuntu
Once the installation finishes, enter Ubuntu:
proot-distro login ubuntu
Your prompt should change to something similar to:
root@localhost:~#
You are now inside the Ubuntu environment.
You can leave it at any time with:
exit
And enter it again later with:
proot-distro login ubuntu
Your Ubuntu filesystem remains available between sessions.
3. Update Ubuntu
Inside Ubuntu, update the package lists and installed packages:
apt update && apt upgrade -y
This is worth doing before installing Claude Code because a fresh Ubuntu container may not have the latest packages and certificates required for downloads.
4. Install Claude Code
Current Claude Code documentation provides an official installer for Linux:
curl -fsSL https://claude.ai/install.sh | bash
The installer places Claude Code in:
~/.local/bin/claude
Anthropic's current documentation also supports an npm installation for Linux systems with Node.js, but the native installer is the simpler route here.
5. Add Claude to PATH
If the installer tells you that claude cannot be found, add its directory to your PATH:
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
Then check the installation:
claude --version
If everything is working, you should get the installed Claude Code version.
A common mistake here is trying to run claude immediately from a non-interactive shell before .bashrc has been loaded.
Using:
source ~/.bashrc
or starting a normal login shell solves that in most cases.
6. Start Claude Code
Now run:
claude
The first launch will ask you to authenticate.
Depending on your Android version and browser setup, the authentication page may open automatically. On some older Android versions, you may need to copy the URL shown in the terminal and open it manually.
Once authentication is complete, Claude Code can work with the files in your current project directory.
A Simple Project Example
Suppose you have a Python project in your Ubuntu home directory.
You could create a directory:
mkdir my-project
cd my-project
Then start Claude:
claude
From there, you can ask it to inspect the project, create files, explain existing code, or make changes.
For example:
Inspect this project and explain how the files are connected.
Or:
Find the bug causing the API request to fail and fix it.
The important difference from a normal AI chat is that the agent can work with the project itself rather than only seeing the code you manually paste into a conversation.
Common Problems
The setup is fairly straightforward, but Termux and Android introduce a few things that can be confusing.
Claude gets stuck on "Checking connectivity"
One problem reported with native Termux installations involves DNS resolution.
Android does not provide the normal Linux /etc/resolv.conf environment that many Linux programs expect. Some Linux binaries rely on a DNS resolver that reads this file, and when it is missing they can fall back to a resolver address where nothing is listening.
This can result in connection attempts hanging or timing out.
This is another reason the Ubuntu route is useful.
If you encounter this problem on a native installation, check the documentation for the specific Termux/Claude compatibility layer you installed rather than randomly changing DNS settings.
Some current native installers include their own DNS workaround for affected devices.
claude: command not found
If Claude installed successfully but the command cannot be found, check your PATH:
echo $PATH
Then:
export PATH="$HOME/.local/bin:$PATH"
Or permanently add it:
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
Then:
claude --version
Native Claude exits immediately
If you are using the native Termux route and Claude suddenly stops working after an update, check the version and the installation method you are using.
This has happened because Claude Code changed its binary distribution and older Termux workarounds were no longer compatible with newer releases.
If you want the least amount of troubleshooting, the Ubuntu route avoids much of this native Android compatibility layer.
Using Claude Code Every Day
Once everything is installed, you do not need to repeat the setup.
Open Termux and enter Ubuntu:
proot-distro login ubuntu
Move into your project:
cd ~/my-project
Then start Claude:
claude
If you want to continue an existing Claude Code session, use the session commands supported by your installed Claude Code version.
The basic workflow is therefore:
Open Termux
↓
Enter Ubuntu
↓
Open project
↓
Start Claude
↓
Work on the project
If you are using a local routing proxy or another service outside Ubuntu, you may instead use two Termux sessions: one session keeps the routing service running while the other enters Ubuntu and runs Claude Code.
For direct Claude API access, you can keep things much simpler and use a single Ubuntu session.
Using Free or Cheaper Models Through a Local Router
There is another setup that some Termux users experiment with.
A local AI router can sit between Claude Code and the model provider:
Claude Code
↓
Local Router
↓
Model Provider
Depending on the router, it may authenticate through an OAuth-connected account and route requests to models available through that provider.
This can be useful when you are testing different models or trying to reduce API costs.
However, this part is much less stable than the basic Termux + Ubuntu setup.
Provider pricing, free tiers, OAuth policies, model availability, and terms of service can change.
Third-party routing tools can also introduce their own security and privacy considerations.
So treat these setups as optional experiments, not as a guaranteed free way to use Claude Code.
If a routing method depends on a provider's free tier or a third-party proxy, check the provider's current terms before relying on it.
What Termux Cannot Replace
Running an AI coding agent on a phone is useful, but a phone is still a phone.
There are some practical limitations.
Battery and heat
AI coding agents can run commands, inspect files, and perform repeated operations.
Long sessions can therefore consume battery and generate heat, especially on less powerful phones.
Android may kill background processes
Some Android manufacturers are aggressive about stopping background applications.
If you leave a long-running process in Termux and switch to another application, Android may eventually terminate it.
Battery optimization settings can also affect Termux.
No real root access
proot-distro does not give you actual root privileges.
It creates a Linux-like environment in userspace. That is enough for many development tasks, but it does not provide the same control as a rooted Android device or a real Linux machine.
Things can break
Termux, Android, Linux packages, and AI coding tools are all changing.
An update can occasionally introduce compatibility problems.
This is especially important with native Termux installations because they depend on compatibility layers between Android and Linux binaries.
The Ubuntu approach reduces some of those problems, but it does not eliminate them completely.
Final Thoughts
You do not need a PC to experiment with AI coding agents anymore.
With Termux and proot-distro, an Android phone can provide a surprisingly capable Linux development environment.
For the setup covered here, Ubuntu inside Termux is the route to start with. It gives Claude Code a conventional Linux environment and avoids many of the compatibility problems that can appear when trying to run Linux binaries directly against Android.
The native Termux approach is still interesting if you want a smaller setup and are comfortable dealing with compatibility workarounds.
But whichever route you choose, the basic idea is simple:
Android
↓
Termux
↓
Linux environment
↓
AI coding agent
↓
Your project
Once that is working, your phone becomes more than a terminal for running commands. It can become a small development environment that you can carry around with you.
And if you're already using Termux for development, tools such as a Password Generator or Hash Generator can also be useful alongside your coding workflow.