How to Install Gemini CLI on Android using Termux
Google发布Gemini CLI工具,支持通过终端访问其AI模型,免费提供每天1000次请求。文章介绍了在Android设备上安装Gemini CLI的方法,并解决Google认证问题,提供两种解决方案:使用调试模式手动登录或借助Termux:API自动触发浏览器登录。 2025-7-9 07:16:52 Author: www.mobile-hacker.com(查看原文) 阅读量:18 收藏

Loading

On June 25, 2025, Google published Gemini CLI is a powerful AI command-line interface agent for interacting with Google’s Gemini models, offering developers and enthusiasts a way to access AI directly from the terminal. It supports up to 60 requests per minute and 1000 requests per day for free using Google authentication instead of limited Gemini API Key. This makes it ideal for high-volume tasks without any extra costs.

However, installing Gemini CLI on Android presents a challenge: command-line environments like Termux don’t support pop-up windows for Google login, which is required for authentication. In this blog, I’ll show you two simple methods to solve this and get Gemini CLI running smoothly on your Android device.

Figure 1. Tested wordlist brute-force to connect to my SSH

Installing Gemini CLI on Android

The installation process is identical to Linux. You’ll need Termux or a similar terminal emulator. I prefer Termux, make sure to download it from F-Droid store or GitHub. Version on Google Play is discontinued.

Here are the steps:

Update packages.

pkg update && pkg upgrade

Install node js.

pkg install nodejs
Figure 2. Installation of NodeJS

Install the Gemini CLI.

npm install -g @google/gemini-cli
Figure 3. Install Gemini CLI

You now have Gemini CLI installed on your Android device!

Run gemini cli:

gemini
Figure 4. Initial Gemini CLI screen

When you try to authenticate, you will be presented with endless Waiting for auth... message, without option to login using Google credentials.

Figure 5. Waiting for authentication info without option to authenticate

To solve this problem, you can use one of the two methods.

Method 1: Authenticate Using debug Mode

This is the simplest method. Run Gemini CLI with the --debug flag:

gemini --debug

Then, initiate authentication:

/auth

Choose Google Login. The CLI will display a login URL in the terminal.

Figure 6. Displayed Google authentication link

Copy this link into your browser, authenticate with your Google account, and return to Termux. Gemini CLI will now be successfully authenticated.

Method 2: Use Termux:API to Trigger Browser Login

For a more seamless experience, you can use Termux:API to open the login URL directly in your browser. Termux-api allows you to send commands to the Android system and send command to open a browser. This means that Termux would trigger Google authentication automatically by opening a browser, just like it would behave on desktop system. For that you need to install:

  1. Install Termux:API app from F-Droid.
  2. In Termux, install the API package:
pkg install termux-api

This will open the browser automatically, mimicking desktop behavior. Once authenticated, return to Termux and continue using Gemini CLI.

Conclusion

Gemini CLI is a powerful and free tool for accessing Google’s Gemini models from the command line. With up to 1000 free requests per day, it’s perfect for developers. Thanks to Termux and Termux:API, you can now run Gemini CLI conveniently on Android—even in headless environments—without sacrificing functionality or ease of use.


文章来源: https://www.mobile-hacker.com/2025/07/09/how-to-install-gemini-cli-on-android-using-termux/
如有侵权请联系:admin#unsafe.sh