This guide shows you how to run the PI Coding Agent CLI on your Android device using Termux and a proot Ubuntu environment.
You have two options:
- ⚡ Option A — Quick Setup using a single
setup.shscript - 🧑💻 Option B — Manual Step-by-Step (recommended if you want to understand each step, or the script doesn't work on your device)
- An Android device
- Termux installed from F-Droid (not the Play Store version, which is outdated and unmaintained)
- A stable internet connection ( ~700MB )
If you just want to get up and running fast, download and run the setup script:
curl -fsSL https://raw.githubusercontent.com/fiozxr/pi-agent-android/main/setup.sh | bashThis script automates all the steps from Option B below. Use Option B if you'd like more control or want to troubleshoot manually.
Download and install Termux here: https://f-droid.org/en/packages/com.termux/ or CLICK THIS
⚠️ Do not install Termux from the Google Play Store — it's outdated and no longer supported.
apt update -y && apt upgrade -y
apt install proot-distro -yproot-distro install ubuntu
proot-distro login ubuntuThis gives you a full* Ubuntu environment running inside Termux.
apt update -y && apt install nodejs -yYou can install PI using either of the following methods:
Option 1 — Official install script:
curl -fsSL https://pi.dev/install.sh | shOption 2 — via npm:
npm install -g --ignore-scripts @earendil-works/pi-coding-agentpiThat's it — PI CLI is now running inside your Ubuntu environment on Termux! 🎉 Run /login and set you API provider and KEY or LOGIN wih 0Auth.
1. Auto-login to Ubuntu when you open Termux (Recommended)
Edit your Termux .bashrc so you're dropped straight into your Ubuntu shell every time you open the app:
nano ~/.bashrcAdd these lines at the end:
clear
proot-distro login ubuntuSave and exit (Ctrl+O, Enter, then Ctrl+X). Now every new Termux session will clear the screen and log you directly into Ubuntu — no need to type proot-distro login ubuntu manually each time.
2. Keep Termux awake during long sessions
Enable a wake lock so Android doesn't kill your Termux session in the background:
termux-wake-lock3. Storage access
If you need to access your phone's storage (Downloads, etc.) from Termux:
termux-setup-storageThis guide is part of a series covering how to run popular AI coding agents on Android/Termux, including:
- Claude
- Codex
- Antigravity
- PI ✅ (this guide)
- ...and more coming soon
- Performance will depend on your device's RAM and CPU — flagship phones will run noticeably smoother.
- If a command fails, try running
apt update -y && apt upgrade -yagain inside Ubuntu before retrying.
