Termux (Android) Setup
Pi runs on Android via Termux, a terminal emulator and Linux environment for Android.
Prerequisites
Section titled “Prerequisites”- Install Termux from GitHub or F-Droid (not Google Play, that version is deprecated)
- Install Termux:API from GitHub or F-Droid for clipboard and other device integrations
Installation
Section titled “Installation”# Update packagespkg update && pkg upgrade
# Install dependenciespkg install nodejs termux-api git
# Install pinpm install -g --ignore-scripts @earendil-works/pi-coding-agent
# Create config directorymkdir -p ~/.pi/agent
# Run pipiClipboard Support
Section titled “Clipboard Support”Clipboard operations use termux-clipboard-set and termux-clipboard-get when running in Termux. The Termux:API app must be installed for these to work.
Image clipboard is not supported on Termux (the ctrl+v image paste feature will not work).
Example AGENTS.md for Termux
Section titled “Example AGENTS.md for Termux”Create ~/.pi/agent/AGENTS.md to help the agent understand the Termux environment:
# Agent Environment: Termux on Android
## Location- **OS**: Android (Termux terminal emulator)- **Home**: `/data/data/com.termux/files/home`- **Prefix**: `/data/data/com.termux/files/usr`- **Shared storage**: `/storage/emulated/0` (Downloads, Documents, etc.)
## Opening URLs```bashtermux-open-url "https://example.com"```
## Opening Files```bashtermux-open file.pdf # Opens with default apptermux-open --chooser image.jpg # Choose app```
## Clipboard```bashtermux-clipboard-set "text" # Copytermux-clipboard-get # Paste```
## Notifications```bashtermux-notification -t "Title" -c "Content"```
## Device Info```bashtermux-battery-status # Battery infotermux-wifi-connectioninfo # WiFi infotermux-telephony-deviceinfo # Device info```
## Sharing```bashtermux-share -a send file.txt # Share file```
## Other Useful Commands```bashtermux-toast "message" # Quick toast popuptermux-vibrate # Vibrate devicetermux-tts-speak "hello" # Text to speechtermux-camera-photo out.jpg # Take photo```
## Notes- Termux:API app must be installed for `termux-*` commands- Use `pkg install termux-api` for the command-line tools- Storage permission needed for `/storage/emulated/0` accessLimitations
Section titled “Limitations”- No image clipboard: Termux clipboard API only supports text
- No native binaries: Some optional native dependencies (like the clipboard module) are unavailable on Android ARM64 and are skipped during installation
- Storage access: To access files in
/storage/emulated/0(Downloads, etc.), runtermux-setup-storageonce to grant permissions
Troubleshooting
Section titled “Troubleshooting”Clipboard not working
Section titled “Clipboard not working”Ensure both apps are installed:
- Termux (from GitHub or F-Droid)
- Termux:API (from GitHub or F-Droid)
Then install the CLI tools:
pkg install termux-apiPermission denied for shared storage
Section titled “Permission denied for shared storage”Run once to grant storage permissions:
termux-setup-storageNode.js installation issues
Section titled “Node.js installation issues”If npm fails, try clearing the cache:
npm cache clean --force