Quick guide to install Google Gemini CLI on Termux (Android). No errors, no complex setups. Get Gemini AI assistant on your phone in 5 minutes.

I'll be honest—last week I asked Gemini how to install a coding assistant on my Android tablet. It told me to install Claude. I did. Claude worked. But then I thought, "Wait, I'm using Gemini to ask how to install Claude. What about the Gemini CLI?" So I dug around, and it turns out Google now has an official, simple‑to‑install Gemini CLI that runs directly on Termux. And it's fast—no proot sandbox, no environment tricks.

If you already have Termux and a Wi‑Fi connection, you can be chatting with Gemini on the command line in under five minutes. This guide shows you the exact steps I followed, plus the tiny fix you might need if your Android device throws a binary format error. No fluff, just the working method.

Prerequisites

  • Termux from F‑Droid (the Play Store version can cause permission issues).
  • Node.js 20 or later: pkg install nodejs
  • A Google account with access to Gemini (free tier works fine).
  • Optional but handy: a Bluetooth keyboard for comfortable typing.

Step 1: Update Termux and Install Node.js

Open Termux and run these commands. The second line updates the package list; the third installs Node.js (the Gemini CLI is distributed via npm).

pkg update
pkg upgrade
pkg install nodejs

Check that Node.js is installed correctly:

node --version   # Should show v20.x or higher
npm --version

Step 2: Install the Gemini CLI Globally

This is the magic step. Google's official CLI package is @google/gemini-cli. Install it globally so you can run gemini from any directory.

npm install -g @google/gemini-cli

If the network is slow, you can use --prefer-offline or wait a moment. After installation, verify the binary exists:

which gemini
# Should output something like:
# /data/data/com.termux/files/usr/bin/gemini

Note: The package installs a Node.js script that communicates with Google's servers. No native binary is downloaded, so it works on Android's underlying Linux kernel without any glibc tricks.

If you get a "permission denied" error: This can happen if npm's global bin directory isn't writable. Fix it with: npm config set prefix ~/.npm-global and add export PATH="$HOME/.npm-global/bin:$PATH" to your .bashrc. Restart Termux and try again.

Step 3: Authenticate with Your Google Account

Run the login command:

gemini login

You'll see a URL. Long‑tap the link in Termux to copy it, then open it in your mobile browser. Sign in with your Google account and grant the necessary permissions. The browser will redirect to a page that says "Authentication complete." Return to Termux and you're in.

Alternatively, if you have a Gemini API key, you can skip the browser login entirely:

export GEMINI_API_KEY="your-api-key"
gemini "Your prompt here"

Step 4: Start Using Gemini CLI

Now simply type gemini followed by your prompt:

gemini "Explain the bubble sort algorithm in 3 lines"

The response appears directly in the terminal. If you want an interactive session (multi‑turn), use gemini chat:

gemini chat

To see a list of available commands and options, run gemini --help.

Troubleshooting Common Issues

"Command not found: gemini"

The npm global directory is not in your PATH. Add this line to ~/.bashrc:

export PATH="$(npm config get prefix)/bin:$PATH"

Then restart Termux or run source ~/.bashrc.

Binary format error ("exec format error")

Since the Gemini CLI is a pure Node.js package, this shouldn't happen. If it does, you've likely accidentally installed a native binary meant for a different platform. Remove any previously forced packages and reinstall only the official CLI.

Authentication loop (browser opens but doesn't complete)

Try clearing the browser cache or using an incognito tab. Also ensure your Google account has the Gemini feature enabled. As of 2026, Gemini is available in most countries, but some regions may still be restricted. A VPN set to a supported country usually resolves this.

Gemini CLI vs. Claude Code on Termux

I've used both on this same tablet. Here's the quick comparison:

  • Gemini CLI: Pure Node.js, installs in one command, no proot‑distro needed, free tier is generous, and it's deeply integrated with Google Search and Workspace.
  • Claude Code: Requires the native binary trick (or proot‑distro), more powerful for heavy coding tasks with file editing, and has a larger token window for code analysis.

For everyday coding questions, script writing, and brainstorming on the go, Gemini CLI is the faster and simpler choice. If you need to refactor an entire project from your phone, Claude Code might be worth the extra effort.

Suggested Image: Screenshot of Gemini CLI answering a coding question inside Termux.

Frequently Asked Questions

Do I need an API key for the Gemini CLI?

No. You can authenticate with your Google account using gemini login. For programmatic use or if you prefer keys, you can set the GEMINI_API_KEY environment variable instead.

Is Gemini CLI free to use on mobile?

Yes. Google offers a generous free tier for Gemini. As of 2026, the Gemini API has a free quota that is more than enough for personal CLI usage. Heavy commercial usage may require billing.

Can I use Gemini CLI without internet?

No. All requests are processed via Google's cloud servers. An active internet connection is required.

Does this drain battery faster than other Terminal tools?

Because the Gemini CLI is a thin client (it sends prompts and receives responses), the battery impact is minimal—similar to running a Terminal‑based chat app. If you're using it intensively for hours, you'll notice the screen and CPU usage, but it's far lighter than running a local model.

Can I switch between different Gemini models?

Yes. Use the --model flag to specify which model you want (e.g., gemini --model gemini-2.0-flash "Hello"). Check the documentation for the available model names.


Further Reading and Related Posts

Over to You

Have you tried any AI command‑line tools on your phone? I'm still amazed that I can debug a Python script while standing in a queue. If you run into any snags setting up the Gemini CLI, drop a comment below—I'll help you figure it out. And if you've compared it to Claude on mobile, I'd love to hear which one you stick with.

Found this quick guide useful? Share it with a friend who thinks AI only runs on desktops. Your phone is a coding powerhouse now.

Comments