Skip to content

Termux - a terminal emulator application for Android OS extendible by variety of packages.

License

Notifications You must be signed in to change notification settings

WangChengYeh/termux_AI

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1,621 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Termux AI: Bootstrap-Free Terminal with Multi-AI Integration

A revolutionary fork of termux/termux-app that eliminates traditional package bootstrapping entirely and includes comprehensive AI development tools. Instead of complex zip extraction and package installation, Termux AI embeds native executables directly into the Android APK as .so files, leveraging Android's automatic library extraction for instant availability.

πŸ€– Multi-AI Support: Gemini CLI, Claude CLI, and Codex CLI built-in
🎬 FFmpeg Integration: Complete multimedia processing capabilities (v7.1.1, 100% dependencies resolved)
⚑ Instant Development: Node.js, Git, and 400+ tools ready immediately

🎯 Key Innovation

Traditional Termux: Complex bootstrap process with zip extraction, package installation, and manual permission setup.

Termux AI: Native executables (binaries + scripts) β†’ Add .so extension β†’ Place in jniLibs/arm64-v8a/ β†’ Android automatically extracts to read-only /data/app/.../lib/arm64/ β†’ Symbolic links provide instant access.

βœ… No bootstrap required - Launch and code immediately
βœ… Multi-AI powered - 3 AI assistants built-in (Gemini, Claude, Codex)
βœ… Multimedia ready - FFmpeg v7.1.1 for professional video/audio processing
βœ… W^X compliant - Executables in read-only system locations
βœ… SELinux compatible - Uses Android's native library mechanism
βœ… Faster startup - No extraction or installation delays

Termux AI in action Termux AI running with Node.js v24.7.0 and AI assistance

ttyd Web Terminal ttyd web terminal interface accessible at localhost:7681

Gemini AI CLI Gemini AI CLI authentication setup with Google login and API key options

πŸŽ‰ Latest Release: v1.8.0 - Clean Executable Naming Convention

Download v1.8.0 | Size: 262.5 MB | SHA256: 1bafcb40111f43e6b9043bfddb6ff28aae47ac669cdc823ea2fdafdc15501eac

What's New in v1.8.0+

  • βœ… Complete AI Integration - Gemini CLI, Claude CLI, and Codex CLI ready-to-use
  • βœ… FFmpeg Multimedia Support - Complete video/audio processing with ffmpeg v7.1.1 and ffprobe (100% dependencies resolved)
  • βœ… 100% Package Integration Success - All 89 packages fully integrated
  • βœ… Clean Naming Convention - Removed lib prefix from 100+ executables
  • βœ… Fixed Android Asset Packaging - Resolved __generated__ directory exclusion
  • βœ… Enhanced Security - Removed OAuth secrets from repository history
  • βœ… Improved Consistency - Executables use .so suffix without lib prefix (e.g., apt.so, dpkg.so, git.so)
  • βœ… Fixed Multicall Binaries - coreutils.so properly handles 100+ commands (ls, cat, cp, mv, etc.)

πŸš€ Quick Start

Requirements

  • Android: 14+ (API level 34+)
  • Architecture: ARM64 (arm64-v8a) devices only
  • Storage: ~262MB APK with complete development environment

Installation

  1. Download APK from Releases - Latest: v1.8.0 (Clean Executable Naming)
  2. Install on ARM64 Android device
  3. Launch app - all executables configured automatically
  4. Ready for development and AI assistance

Immediate Usage

# πŸ€– AI Development Tools
gemini --help          # Google Gemini AI CLI v0.3.3
claude --help          # Anthropic Claude AI CLI
codex --help           # AI coding assistant
codex-exec --help      # Non-interactive AI execution

# 🎬 Multimedia Processing
ffmpeg -version        # FFmpeg v7.1.1 multimedia framework (100% dependencies resolved)
ffprobe -version       # Media file analyzer (complete library support)

# πŸ’» Core Development Stack
node --version         # Node.js v24.7.0
npm --version          # Package manager v11.5.1
git --version          # Version control v2.51.0
gh --version           # GitHub CLI v2.78.0

# πŸ“¦ System Management
apt --version          # Package management v2.8.1
curl --version         # Data transfer tool v8.15.0
ls /usr/bin            # 400+ available commands

πŸ— Architecture Overview

Bootstrap-Free Design

Aspect Traditional Termux Termux AI
Setup Complex zip extraction & package installation Instant - executables pre-integrated
First Launch 5-10 minutes bootstrap < 5 seconds ready
Package Management Download β†’ Extract β†’ Install β†’ Configure Already integrated in APK
Security Writable directories, permission issues W^X compliant, read-only executables
Storage Location /data/data/com.termux/files/usr/ /data/app/.../lib/arm64/ (system)

Revolutionary Executable Integration

The Core Principle: Any ARM64 executable can become a "fake shared library" by simply adding .so extension.

# Traditional approach
node (binary) β†’ Extract β†’ Install β†’ Set permissions β†’ Symlink

# Termux AI approach  
node (binary) β†’ Rename to node.so β†’ Place in jniLibs/ β†’ Android handles everything

Step-by-step process:

  1. Binary executables (node, git, gh) β†’ Add .so postfix β†’ node.so, git.so
  2. Script files (npm, npx) β†’ Also become .so files β†’ npm.so, npx.so
  3. Android APK build β†’ Automatically includes all .so files from jniLibs/arm64-v8a/
  4. App installation β†’ Android extracts to /data/app/.../lib/arm64/ (read-only, executable)
  5. First launch β†’ TermuxInstaller.java creates symbolic links in /usr/bin/
  6. Ready to use β†’ node --version, npm install, git clone work instantly

Security & Compliance

  • W^X Policy: Executables in read-only /data/app system location
  • SELinux Compatible: Uses Android's native library extraction mechanism
  • Android 14+: Full support with foreground service permissions

πŸ“¦ Included Software

Core Development Tools

Component Version Description
Node.js v24.7.0 JavaScript runtime with V8 engine
npm v11.5.1 Node.js package manager
npx Latest Package executor for Node.js
Git v2.51.0 Distributed version control system
GitHub CLI v2.78.0 GitHub integration and automation
Vim v9.1.1700 Advanced text editor
Bash v5.3.3-1 GNU Bourne Again Shell

πŸ€– AI & Automation (Triple AI Power)

Component Version Description Use Case
Gemini CLI v0.3.3 Google's Gemini AI with multimodal capabilities gemini "explain this code"
Claude CLI Latest Anthropic's Claude AI for advanced reasoning claude "help with this function"
Codex CLI v0.25.0 AI-powered coding assistant codex "write a REST API"
Codex-Exec v0.25.0 Non-interactive AI command execution codex-exec "fix this bug"

Why Three AI Tools?

  • 🧠 Different strengths - Each AI excels in different areas
  • πŸ”„ Fallback options - If one is unavailable, others continue working
  • 🎯 Specialized tasks - Choose the best AI for your specific needs

Package Management

Component Version Description
APT v2.8.1-2 Advanced Package Tool
DPKG v1.22.6-4 Debian package management system
Core Utils v9.7-3 GNU core utilities (100+ commands)

Network & Security

Component Version Description
OpenSSH v10.0p2-9 Secure shell client and server
curl v8.15.0-1 Command-line data transfer tool
OpenSSL v3.5.2 Cryptography and SSL/TLS toolkit
DNS Utils v9.20.12 BIND DNS tools (dig, nslookup, host)
CA Certificates 2025.08.12 Mozilla CA certificate bundle (146 certs)
Less v679-2 Terminal pager for viewing text files

🎬 Multimedia Tools (FFmpeg Complete)

Component Version Description Capabilities
FFmpeg v7.1.1-6 Complete multimedia framework (100% dependencies) Encode, decode, transcode, stream, filter
FFprobe v7.1.1-6 Multimedia stream analyzer (complete library support) Extract metadata, analyze formats, inspect streams

FFmpeg Power on Android:

  • πŸŽ₯ Video Processing - Convert, compress, edit video files
  • 🎡 Audio Manipulation - Extract, convert, enhance audio streams
  • πŸ“± Mobile Optimized - ARM64-native for optimal Android performance
  • πŸ”§ Professional Grade - Same tool used by YouTube, Netflix, and major platforms

System Libraries

Library Version Purpose
libicu v77.1-1 Unicode and localization support
libxml2 v2.14.5-1 XML parsing library
libcurl v8.15.0-1 Data transfer library
libsqlite v3.50.4-1 SQL database engine
libgcrypt v1.11.2-1 Cryptographic library
pcre2 v10.46 Perl-compatible regular expressions
ncurses v6.5.20240831-3 Terminal control library
readline v8.3.1-1 Command-line editing library
zlib v1.3.1-1 Compression library
libiconv v1.18-1 Character encoding conversion
json-c v0.18-1 JSON parsing library
libass v0.17.4 ASS/SSA subtitle rendering library
freetype v2.13.3 Font rendering engine

Complete Package List (48 packages, 500MB) - 100% Integration Success βœ…

πŸŽ‰ PERFECT INTEGRATION: All 48 packages with executables/libraries are now fully integrated and working!

Click to view all packages
  • android-codex-cli-0.25.0
  • apt_2.8.1-2
  • bash_5.3.3-1
  • bzip2_1.0.8-8
  • c-ares_1.34.5
  • ca-certificates_1:2025.08.12
  • coreutils_9.7-3
  • curl_8.15.0-1
  • dnsutils_9.20.12
  • dpkg_1.22.6-4
  • gh_2.78.0
  • git_2.51.0
  • json-c_0.18-1
  • krb5_1.17-2
  • ldns_1.8.4-1
  • less_679-2
  • libandroid-execinfo_0.1-3
  • libandroid-glob_0.6-3
  • libandroid-selinux_14.0.0.11-1
  • libandroid-support_29-1
  • libbz2_1.0.8-8
  • libc++_28c
  • libcurl_8.15.0-1
  • libgcrypt_1.11.2-1
  • libgmp_6.3.0-2
  • libgpg-error_1.55-1
  • libiconv_1.18-1
  • libicu_77.1-1
  • liblzma_5.8.1-1
  • libnghttp2_1.67.0
  • libnghttp3_1.11.0-1
  • libsqlite_3.50.4-1
  • libssh2_1.11.1-1
  • libxml2_2.14.5-1
  • ncurses_6.5.20240831-3
  • nodejs_24.7.0
  • openssh_10.0p2-9
  • openssl_1:3.5.2
  • pcre2_10.46
  • readline_8.3.1-1
  • resolv-conf_1.3
  • termux-exec_1:2.3.0
  • vim_9.1.1700
  • which_2.23
  • xz-utils_5.8.1-1
  • zlib_1.3.1-1
  • zstd_1.5.7-1

πŸ›  Development Workflow

πŸ€– Automated Package Integration (SOP)

The Standard Operating Procedure transforms any Termux .deb package into Android-native executables:

# 🎯 One-command integration (recommended)
make sop-add-package PACKAGE_NAME=nodejs VERSION=24.7.0

# πŸ” Step-by-step debugging workflow
make sop-list LETTER=n                # πŸ“‹ Browse available packages
make sop-download PACKAGE_NAME=nodejs VERSION=24.7.0  # πŸ“¦ Fetch .deb
make sop-extract PACKAGE_NAME=nodejs  # πŸ“‹ Unpack contents
make sop-analyze PACKAGE_NAME=nodejs  # πŸ” Identify executables & deps
make sop-copy PACKAGE_NAME=nodejs     # ➑️ Transform to .so files
make sop-update PACKAGE_NAME=nodejs   # πŸ“ Update Java integration
make sop-build                        # πŸ› οΈ Build & test APK

# πŸ§ͺ Package verification commands
make sop-check PACKAGE_NAME=nodejs    # βœ… Verify single package integration
make sop-check-all                    # πŸ“Š Test all 89 packages (100% success)

# πŸ”„ Package update management
make sop-check-updates PACKAGE_NAME=nodejs  # πŸ” Check if package has newer version
make sop-check-all-updates            # πŸ“Š Check all local packages for updates
make sop-get-packages                 # πŸ“₯ Download repository metadata

πŸ”§ Systematic Dependency Resolution

For complex packages like FFmpeg with extensive multimedia dependencies, use the SOP Loop for systematic resolution:

# 🎯 Dependency Resolution Loop (until all dependencies are satisfied)
make sop-ldd-test PACKAGE_NAME=ffmpeg    # πŸ” Identify missing libraries
make sop-find-lib LIBRARY=libssl.so      # πŸ“‹ Find package containing library  
make sop-add-package PACKAGE_NAME=openssl VERSION=3.5.2  # βž• Add dependency
make build && make install               # πŸ› οΈ Test integration
# Repeat until sop-ldd-test shows all libraries found

# πŸ§ͺ Comprehensive testing
make sop-ldd-test                        # πŸ“Š Test all 17 executables for dependencies

Real-world example - FFmpeg multimedia integration required resolving 20+ dependencies:

  • AV1 codecs: libaom, librav1e, libSvtAv1Enc, libdav1d
  • Audio codecs: libopencore-amr, libmpg123, libtheora, libFLAC
  • Security: libsodium, libvo-amrwbenc
  • Formats: libwebp, libbluray, libudfread

Each iteration of the SOP loop identifies the next missing dependency, achieving 17/17 executables (100%) passing dependency tests with complete FFmpeg resolution.

What happens under the hood:

  1. Download .deb from Termux repository
  2. Extract using dpkg-deb to analyze contents
  3. Transform binaries: usr/bin/node β†’ jniLibs/arm64-v8a/node.so (No lib prefix needed for executables)
  4. Update TermuxInstaller.java with new executable mappings
  5. Build APK with integrated native executables

πŸ”§ Resolving Missing Dependencies

When you see runtime errors like "library libcharset.so not found", here's the systematic approach:

πŸ” Step 1: Find the source package

grep "libcharset.so" packages/Contents-aarch64
# Output: usr/lib/libcharset.so.1 libiconv
#         ^^^ library file    ^^^ source package

πŸ“¦ Step 2: Download & extract dependency

make sop-download PACKAGE_NAME=libiconv VERSION=1.18-1
make sop-extract PACKAGE_NAME=libiconv

➑️ Step 3: Transform library to Android format

cp packages/libiconv-extract/data/data/com.termux/files/usr/lib/libcharset.so.1 \
   app/src/main/jniLibs/arm64-v8a/libcharset.so
#  ^^^ Original versioned name                 ^^^ Simplified Android name

πŸ“ Step 4: Update Java integration

  • Add "libcharset.so" to baseLibraries array in TermuxInstaller.java
  • This ensures the library is available when executables need it

πŸ› οΈ Step 5: Build and verify

make build && make install && make run
# Test: Launch app, run command that needed the library

πŸ’‘ Pro tip: The Contents-aarch64 file maps every file to its source package, making dependency resolution straightforward.

πŸ§ͺ Package Integration Verification (SOP Check)

The SOP Check system ensures every integrated package works correctly on the Android device:

# Check a specific package integration
make sop-check PACKAGE_NAME=nodejs

What it verifies:

  • πŸ“¦ Host Analysis: Identifies all executables, libraries, and scripts from the package
  • πŸ“± Device Verification: Confirms each file exists and is accessible on device
  • πŸ”§ Functional Testing: Executes commands to verify they run without errors
  • πŸ“Š Dependency Resolution: Checks all required libraries are present

Example output for successful package:

πŸ” SOP Checker: Comparing nodejs files between host and device
============================================================================
πŸ“¦ Host Package Analysis
πŸ”§ Executables in /usr/bin:
  πŸ“„ node (NATIVE) - Expected in /usr/bin/ via jniLibs
  πŸ“œ npm (SCRIPT) - Expected in /usr/bin/ via assets
  πŸ“œ npx (SCRIPT) - Expected in /usr/bin/ via assets

πŸ“± Device Verification
βœ… node - EXISTS (symlink β†’ /data/app/.../lib/arm64/node.so)
βœ… npm - EXISTS (symlink β†’ /data/data/com.termux/files/usr/lib/node_modules/npm/bin/npm-cli.js)

πŸ§ͺ Functional Testing
βœ… node --version: v24.7.0
βœ… npm --version: 11.5.1

πŸ“Š Summary
βœ… All 3 files from nodejs are present and accessible

πŸ“Š Comprehensive Package Testing

Test all 89 integrated packages at once:

make sop-check-all

Features:

  • πŸ”„ Auto-extraction: Downloads and extracts any missing packages
  • πŸ“Š Progress tracking: Shows real-time status for each package
  • πŸ“ˆ Summary report: Final statistics with pass/fail counts
  • 🎯 100% Success rate: v1.8.0 achieves complete package integration

Example summary:

πŸ“ˆ Final Summary
================
πŸ“Š Packages checked: 89
βœ… Passed: 89
❌ Failed: 0

πŸŽ‰ All extracted packages are properly integrated!

Complete Example: Adding Git v2.51.0

The Magic: Transform a traditional Linux binary into an Android-native executable:

# 1. Download the Termux package
wget -O packages/git_2.51.0_aarch64.deb \
  "https://packages.termux.dev/apt/termux-main-21/pool/main/g/git/git_2.51.0_aarch64.deb"

# 2. Extract the package
dpkg-deb -x packages/git_2.51.0_aarch64.deb packages/git-extract

# 3. The key transformation: Binary β†’ Fake shared library
cp packages/git-extract/data/data/com.termux/files/usr/bin/git \
   app/src/main/jniLibs/arm64-v8a/git.so
#   ^^^^^ ARM64 binary becomes git.so (no lib prefix for executables) ^^^^^

# 4. Handle missing dependencies (discovered at runtime)
# App crash: "library libcharset.so not found"

# 5. Find dependency source using Contents index
grep "libcharset.so" packages/Contents-aarch64
# Output: usr/lib/libcharset.so.1 libiconv

# 6. Add the missing dependency
wget -O packages/libiconv_1.18-1_aarch64.deb \
  "https://packages.termux.dev/apt/termux-main-21/pool/main/libi/libiconv/libiconv_1.18-1_aarch64.deb"
dpkg-deb -x packages/libiconv_1.18-1_aarch64.deb packages/libiconv-extract
cp packages/libiconv-extract/.../libcharset.so.1 app/src/main/jniLibs/arm64-v8a/libcharset.so
cp packages/libiconv-extract/.../libiconv.so.2 app/src/main/jniLibs/arm64-v8a/libiconv.so

# 7. Update Java integration code
# In TermuxInstaller.java:
# executables array: {"git.so", "git"}
# baseLibraries array: "libcharset.so", "libiconv.so"

# 8. Build, install, and test
make build && make install && make run
# Result: git --version shows "git version 2.51.0"

What just happened?

  • Git binary (ARM64 ELF) β†’ Renamed to git.so β†’ Android treats it as a shared library
  • Android automatically extracts to /data/app/.../lib/arm64/git.so with executable permissions
  • Symbolic link /usr/bin/git β†’ Points to the extracted location
  • Dependencies resolved the same way β†’ No complex package management needed

πŸ› οΈ Build & Deploy Workflow

Quick Command Reference

Category Command Description
Development make build Build debug APK
make install Install APK with permissions
make run Launch Termux AI
make logs Monitor app logs
Testing make sop-check PACKAGE_NAME=git Verify single package
make sop-check-all Test all 89 packages
make sop-user-test Automated UI testing
make sop-test Interactive testing
Package Management make sop-add-package PACKAGE_NAME=vim VERSION=9.1.1700 Add new package
make sop-list LETTER=v Browse packages
make sop-analyze PACKAGE_NAME=vim Analyze dependencies
make sop-check-updates PACKAGE_NAME=vim Check for package updates
make sop-check-all-updates Check all packages for updates
Dependency Resolution make sop-ldd-test PACKAGE_NAME=ffmpeg Test executable for missing libraries
make sop-ldd-test Test all executables (comprehensive)
make sop-find-lib LIBRARY=libssl.so Find package containing library
Production BUILD_TYPE=release make build Build release APK
make github-release Create GitHub release
Diagnostics make doctor Check development environment
make check-jnilibs Verify .so files
make check-duplicates Find conflicts

File Naming & Integration Rules

File Type Original Termux AI Location Example
ARM64 Binary node jniLibs/arm64-v8a/node.so Node.js runtime
Shell Script npm jniLibs/arm64-v8a/npm.so Package manager script
JavaScript Module gemini.js assets/termux/usr/lib/node_modules/gemini.js For require/import
JavaScript Executable gemini.js jniLibs/arm64-v8a/gemini.so CLI command
Shared Library libssl.so.3 jniLibs/arm64-v8a/libssl3.so OpenSSL library
Dependencies node_modules/ assets/termux/usr/lib/node_modules/ NPM ecosystem

Key Insights:

  • βœ… No lib prefix needed β†’ Executables use simple naming: node.so, git.so, npm.so
  • βœ… Executable rule β†’ All executables (binaries, shell scripts, Node.js scripts) get .so postfix and go in jniLibs/
  • βœ… JavaScript modules β†’ Keep .js extension and place in assets/termux/usr/lib/node_modules/ for imports
  • βœ… Libraries keep prefix β†’ System libraries use lib prefix: libssl3.so, libcurl.so
  • βœ… Assets for data β†’ Large dependency trees and importable modules go in assets/

Integration Rules:

  1. Executable Integration (for CLI commands):

    • ANY executable file (binary, shell script, Node.js script) β†’ Add .so extension β†’ Place in jniLibs/arm64-v8a/
    • Android extracts all .so files to system location with executable permissions
    • TermuxInstaller creates symbolic links from /usr/bin/ to the extracted executables
  2. JavaScript Module Integration (for require/import):

    • JavaScript files intended for require() or import β†’ Keep .js extension β†’ Place in assets/termux/usr/lib/node_modules/
    • Allows other scripts to import: require('gemini.js') or import gemini from 'gemini.js'
  3. Dual Integration (for Node.js tools that are both CLI and module):

    • Place same content in both locations: jniLibs/arm64-v8a/gemini.so (executable) + assets/.../node_modules/gemini.js (module)
    • Enables both CLI usage (gemini --help) and programmatic usage (require('gemini.js'))

πŸ”§ Technical Deep Dive

πŸ“‹ Project Structure

termux_AI/
β”œβ”€β”€ packages/                              # πŸ“¦ Downloaded .deb packages
β”‚   β”œβ”€β”€ nodejs_24.7.0_aarch64.deb          # Source packages
β”‚   β”œβ”€β”€ git_2.51.0_aarch64.deb
β”‚   └── Contents-aarch64                   # Package index for dependencies
β”‚
β”œβ”€β”€ app/src/main/
β”‚   β”œβ”€β”€ jniLibs/arm64-v8a/                 # βš™οΈ EXECUTABLE DIRECTORY
β”‚   β”‚   β”œβ”€β”€ node.so                        # Node.js binary (24MB)
β”‚   β”‚   β”œβ”€β”€ git.so                         # Git binary (2.1MB)
β”‚   β”‚   β”œβ”€β”€ gemini.so                      # Gemini AI CLI script (12MB)
β”‚   β”‚   β”œβ”€β”€ libssl3.so                     # OpenSSL library
β”‚   β”‚   └── libcurl.so                     # cURL library
β”‚   β”‚
β”‚   β”œβ”€β”€ assets/termux/usr/lib/             # πŸ“‹ MODULES & DEPENDENCIES
β”‚   β”‚   β”œβ”€β”€ node_modules/                  # NPM ecosystem
β”‚   β”‚   β”‚   β”œβ”€β”€ npm/                       # NPM package manager
β”‚   β”‚   β”‚   β”œβ”€β”€ corepack/                  # Node.js package manager manager
β”‚   β”‚   β”‚   └── gemini.js                  # Gemini module for require/import
β”‚   β”‚   └── ca-certificates/               # SSL certificates
β”‚   β”‚
β”‚   └── java/.../TermuxInstaller.java      # πŸ”— Symlink orchestration
β”‚
β”œβ”€β”€ Makefile                               # πŸ€– Automation commands
└── releases/                              # πŸ“¦ Generated APKs

βš™οΈ Core Architecture Insights

The .so File Magic:

  • Any ARM64 executable can masquerade as a shared library
  • Android's APK installer automatically handles .so files
  • No special NDK compilation required - just rename binary files

Why This Works:

  1. Android assumption: .so files in jniLibs/ are native libraries
  2. Reality: They can be any ARM64 executable with .so extension
  3. Result: Android extracts them to system space with executable permissions
  4. Access: Symbolic links provide traditional Unix PATH access

Runtime Environment Layout

πŸ“± Android System Locations (Read-only, W^X compliant)
/data/app/~~long-hash~~/com.termux/lib/arm64/
β”œβ”€β”€ node.so             # Node.js v24.7.0 runtime (24MB)
β”œβ”€β”€ npm.so              # npm package manager script
β”œβ”€β”€ npx.so              # npx package executor script
β”œβ”€β”€ git.so              # Git v2.51.0 binary (2.1MB)
β”œβ”€β”€ gh.so               # GitHub CLI v2.78.0 (15MB)
β”œβ”€β”€ libssl3.so          # OpenSSL v3.5.2 library
└── libcurl.so          # cURL v8.15.0 library

🏠 Termux Home Environment (Read-write)
/data/data/com.termux/files/usr/
β”œβ”€β”€ bin/                # Symbolic links to Android system locations
β”‚   β”œβ”€β”€ node -> /data/app/.../lib/arm64/node.so    ⚑
β”‚   β”œβ”€β”€ npm -> /data/app/.../lib/arm64/npm.so      ⚑
β”‚   β”œβ”€β”€ npx -> /data/app/.../lib/arm64/npx.so      ⚑
β”‚   β”œβ”€β”€ git -> /data/app/.../lib/arm64/git.so      ⚑
β”‚   └── gh -> /data/app/.../lib/arm64/gh.so        ⚑
β”œβ”€β”€ lib/
β”‚   β”œβ”€β”€ node_modules/   # NPM packages extracted from assets
β”‚   β”‚   β”œβ”€β”€ npm/        # NPM package manager
β”‚   β”‚   └── corepack/   # Node.js package manager manager
β”‚   └── *.so           # Additional shared libraries
└── home/              # User workspace (projects, configs)

The Beauty:

  • πŸ”’ Executables: Immutable, in Android system space, W^X compliant
  • πŸ“ User data: Mutable, in app private space, writable
  • ⚑ Performance: No file copying, just symbolic links
  • πŸ›‘οΈ Security: SELinux-friendly, uses Android's native mechanisms

Environment Customization

The .profile automatically sources /data/local/tmp/android_sourceme if it exists, allowing for custom environment setup:

# Place custom configuration in /data/local/tmp/android_sourceme
adb shell "echo 'export CUSTOM_VAR=value' > /data/local/tmp/android_sourceme"

# The file will be automatically sourced on app launch
# See examples/android_sourceme_example.sh for configuration ideas

Key Modifications

  • TermuxInstaller.java: Replaced bootstrap with native executable verification
  • TermuxShellEnvironment.java: Simplified PATH to /system/bin only
  • AndroidManifest.xml: Android 14+ foreground service permissions
  • TermuxActivity.java: Fixed broadcast receiver export flags

πŸ“ Command Reference

πŸ€– AI-Powered Development (Triple AI Support)

Command AI Provider Purpose Example
gemini Google Multimodal AI with vision capabilities gemini "explain this code"
claude Anthropic Advanced reasoning and code analysis claude "help with this function"
codex AI Assistant Interactive coding companion codex "write a REST API"
codex-exec AI Assistant Non-interactive command execution codex-exec "fix this bug"

πŸ’‘ Pro Tip: Try different AIs for the same task to get varied perspectives and solutions!

πŸ’» Core Development Stack

Tool Version Description
node v24.7.0 JavaScript/TypeScript runtime
npm v11.5.1 Package manager
npx Latest Package executor
git v2.51.0 Version control
gh v2.78.0 GitHub CLI
vim v9.1.1700 Text editor
bash v5.3.3 Shell environment

🎬 Multimedia Processing

Tool Version Description Common Use Cases
ffmpeg v4.2.1 Complete multimedia framework ffmpeg -i input.mp4 output.avi
ffprobe v4.2.1 Media file analyzer ffprobe -v quiet -show_format video.mp4

πŸ“¦ Package & System Management

Category Commands Count
Package tools apt, pkg, dpkg 3
Core utilities cat, ls, grep, find, curl 100+
Network tools ssh, scp, curl, dig, host 20+
Development make, gcc, python (via APT) Unlimited

πŸ’‘ Quick test: Run ls /usr/bin | wc -l to see total available commands (296+)

πŸš€ Practical Examples

AI Development Assistance

# Get help with complex code
gemini "Explain this Python function: def fibonacci(n): return n if n <= 1 else fibonacci(n-1) + fibonacci(n-2)"

# Code review and optimization
claude "Review this JavaScript code for potential security issues: const user = eval(input)"

# Generate boilerplate code
codex "Create a Node.js Express server with authentication middleware"

# Debug and fix issues
codex-exec "Fix the syntax error in my Python script"

Multimedia Processing with FFmpeg

# Convert video formats
ffmpeg -i input.mp4 -c:v libx264 -c:a aac output.mp4

# Extract audio from video
ffmpeg -i video.mp4 -vn -acodec copy audio.m4a

# Resize video for mobile
ffmpeg -i input.mp4 -vf scale=720:480 -c:a copy mobile.mp4

# Get video information
ffprobe -v quiet -print_format json -show_format -show_streams video.mp4

Combining AI + Development + Multimedia

# Use AI to generate FFmpeg commands
claude "Generate an FFmpeg command to compress a 4K video to 1080p with good quality"

# Get coding help for multimedia projects
gemini "Write a Node.js script that uses child_process to run FFmpeg commands"

# Debug multimedia issues
codex "Why is my FFmpeg command producing corrupted audio output?"

πŸ§ͺ Testing & Verification

Automated Testing

make sop-user-test   # Automated UI testing via ADB
make sop-test        # Interactive command testing
make logs           # Monitor app behavior

πŸ‘₯ Manual Verification

Connect and test the magic:

# πŸ”Œ Get shell access to running Termux AI
adb shell run-as com.termux
cd /data/data/com.termux/files/home

# πŸ§ͺ Test core functionality
node --version      # βœ… Should show: v24.7.0
npm --version       # βœ… Should show: v11.5.1
git --version       # βœ… Should show: git version 2.51.0
gh --version        # βœ… Should show: gh version 2.78.0
codex --help        # βœ… Should show: AI CLI assistance

# πŸ” Verify the architectural magic
ls -la /usr/bin/    # πŸ”— All symlinks to /data/app/.../lib/arm64/
ls -la /data/app/*/com.termux/lib/arm64/  # πŸ“± Android-extracted binaries
echo $PATH          # πŸ“‹ Should include /data/data/com.termux/files/usr/bin

# 🏁 Real-world test
npm init -y         # πŸ“¦ Create package.json
echo 'console.log("Hello Termux AI!")' > hello.js
node hello.js       # ✨ Execute JavaScript
git init && git status  # πŸ“ Version control works

⚠️ Current Limitations & Scope

Limitation Reason Workaround
ARM64 only Termux packages are architecture-specific Use ARM64 Android device (most modern phones)
Android 14+ Foreground service permissions Update Android or use older Termux version
Package subset APK size constraints (262MB current) Core development tools included
Single architecture APK optimization for size Future: Multi-architecture support

What's Included vs. What's Not:

  • βœ… Included: Core development tools (Node.js, Git, AI tools)
  • βœ… Available via APT: Additional packages from Termux repository
  • ❌ Not included: GUI applications, X11 support, desktop environments
  • ❌ Architecture limit: x86, x86_64, ARMv7 not supported in current build

πŸ“ˆ Project Status

βœ… Revolutionary Features Completed

Feature Traditional Termux Termux AI
First Launch 5-10 min bootstrap ⚑ Instant (0 seconds)
App Size ~8MB + 500MB download πŸ“ 262MB complete
Installation Multi-step, fragile πŸ‘ One APK install
Security Writable executables πŸ”’ Read-only W^X compliant
AI Integration Manual setup πŸ€– Built-in Gemini & Codex CLI
Package Integration Manual, error-prone 🎯 100% Success Rate

πŸš€ Production Ready - 100% Package Integration Success!

  • 89 packages integrated natively with 100% success rate
  • Additional AI tools - Gemini CLI and Codex CLI for enhanced development
  • 400+ commands available instantly without bootstrap
  • Clean naming convention - No lib prefix for executables
  • 262MB APK with complete development environment
  • Android 14+ compatibility with foreground services
  • Automated releases via GitHub Actions
  • Zero bootstrap - launch and code immediately

🎯 Recent Major Improvements (v1.8.0 - September 2025)

  • βœ… Clean Naming Convention - Removed lib prefix from 100+ executables
  • βœ… 100% Package Integration - All 89 packages fully working
  • βœ… Comprehensive SOP Testing - make sop-check-all verifies everything
  • βœ… Fixed Multicall Binaries - coreutils.so handles 100+ commands correctly
  • βœ… Enhanced Documentation - Complete command reference and examples

πŸ“– Additional Resources

  • SOP Documentation: Run make sop-help for complete package integration guide
  • Build System: Run make help for all available commands
  • GitHub Releases: Automated via make github-release
  • Issue Tracking: Report problems via GitHub Issues

πŸ“„ License

Follows upstream Termux licensing. See individual component licenses for native binaries.


Ready to develop? Download the latest release and start coding with Node.js v24.7.0 and AI assistance immediately!

About

Termux - a terminal emulator application for Android OS extendible by variety of packages.

Resources

License

Security policy

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Vim Script 68.9%
  • Java 12.6%
  • C++ 9.4%
  • Perl 2.7%
  • C 2.3%
  • Shell 1.9%
  • Other 2.2%