๐Ÿค– Gemini CLI

February 2, 2026 ยท View on GitHub

Android/Termux optimized fork of Google Gemini CLI (google-gemini/gemini-cli).

  • โœ… Tracks upstream regularly
  • โœ… Minimal, Termux-focused patches
  • โœ… Tested release: v0.28.0-termux (tag: v0.28.0-termux)

npm downloads license ko-fi


Gemini CLI Termux screenshot

What is this?

This repository packages a Termux-first build of Gemini CLI:

If you are on macOS / Linux / Windows, you should install the upstream package:

npm install -g @google/gemini-cli

Why a Termux fork?

Gemini CLI is designed for desktop platforms. On Termux/Android, a few dependencies and environment assumptions can break or degrade UX.

This fork keeps the upstream experience intact while adding the smallest possible patch-set to make it reliable on Android:

  • Native ARM64 PTY support (no node-gyp build on device)
  • Termux-friendly clipboard detection
  • Mobile filesystem + environment guardrails
  • Context Memory integration (persistent memory in ~/.gemini/context_memory/)
  • TTS (Text-to-Speech) support via termux-tts-speak

Installation (Termux)

Prerequisites

pkg update && pkg upgrade -y
pkg install -y nodejs-lts

Optional but recommended for a better mobile experience:

pkg install -y termux-api

Install

npm install -g @mmmbuto/gemini-cli-termux@latest

gemini --version

Update

npm install -g @mmmbuto/gemini-cli-termux@latest

Upstream release channels

Upstream publishes latest, preview, and nightly builds. This fork is meant to track upstream stable while keeping Termux fixes.


Quick start

Interactive mode:

cd /path/to/your/project

gemini

Useful slash commands inside the session:

/help
/auth

Headless / CI usage:

gemini -p "Explain the project structure" \
  -o json

Authentication

Gemini CLI supports multiple authentication methods (Google login, Gemini API key, Vertex AI). Termux users can use the same options as upstream.

Start gemini, then run:

/auth

Follow the on-screen flow.

Note (Android): Google login uses a browser flow that redirects to a localhost URL the CLI listens on during setup. Use the browser on the same device.

Environment variables (headless / CI)

Gemini API key (Google AI Studio):

export GEMINI_API_KEY="YOUR_GEMINI_API_KEY"

Vertex AI (examples):

export GOOGLE_GENAI_USE_VERTEXAI=true
export GOOGLE_CLOUD_PROJECT="YOUR_PROJECT_ID"
export GOOGLE_CLOUD_LOCATION="us-central1"

# Option A: API key
export GOOGLE_API_KEY="YOUR_GOOGLE_API_KEY"

# Option B: Service account
# export GOOGLE_APPLICATION_CREDENTIALS="/absolute/path/to/keyfile.json"

Persisting without leaking secrets: create a .gemini/.env file (project-level) or ~/.gemini/.env (user-level).

Full docs:


Termux optimizations

This fork applies a minimal set of Termux-specific fixes:

  • Clipboard detection fixes for Android/Termux environments.
  • ARM64 PTY prebuild for responsive interactive UI on Android.
  • Termux-API tool discovery (when termux-api is installed).
  • Mobile-safe guards (avoids desktop-only assumptions for paths, keychains, etc.).
  • googleSearch tool fix - works without requiring additional NPM installs.

See docs/TERMUX.md for Termux-specific documentation.


Known differences vs upstream (v0.28.0-termux)

From the latest test reports:

Linux x86_64 (VPS1):

  • gemini extensions settings works, may appear as config in some versions
  • auth / logout are functional but may not appear in the top-level help output
  • A standalone PTY require-test may fail in some environments even when PTY works in the app
  • Context Memory: โœ… Functional - reads from ~/.gemini/context_memory/
  • TTS (Text-to-Speech): โœ… Functional - reads from settings, termux-tts-speak enabled by default
  • googleSearch tool: โœ… Fixed - works without external dependencies

Termux ARM64 (Android):

  • Context Memory: โš ๏ธ init ENOENT on empty path; files exist
  • Agent TOML: โŒ loader file not found (source older than test suite)
  • PTY: โœ… loaded correctly
  • Termux-API: โœ… detection & discovery OK

Full reports:


Documentation


Build from source (Termux)

git clone https://github.com/DioNanos/gemini-cli-termux.git
cd gemini-cli-termux
npm install
npm run build && npm run bundle
node bundle/gemini.js --version

Disclaimer

This is an independent community fork created to improve the Termux experience.

Gemini CLI is an upstream project by Google, licensed under Apache-2.0.


Support

If this project saved you time (or helped you run real work from your phone), you can support it here: