What is Gemini CLI?
Gemini CLI is an open-source command-line AI tool developed by the Google Gemini team, specifically designed for developers. It can understand code, execute complex queries, automate tasks, and leverage Gemini’s multimodal capabilities (like image recognition) to generate creative content.
GitHub: https://github.com/google-gemini/gemini-cli
Key Features:
Large codebase support: Handles over 1 million tokens in context, making it easy to analyze large projects.
Multimodal app prototyping: Quickly generate app prototypes from PDFs or sketches.
Automated DevOps tasks: Perform Git operations, fetch PRs, create migration plans, and more.
Tool integration: Connect to media generation models like Imagen, Veo, and Lyria via an MCP server.
Web search ready: Built-in Google Search ensures up-to-date, reliable responses.
How to Install Gemini CLI
Prerequisites
Make sure you have Node.js 18 or later installed. You can check by running:
node -v
This guide uses macOS as an example, but the steps are similar on Windows — everything happens in the terminal.
Option 1: Run Directly (No Installation)
npx https://github.com/google-gemini/gemini-cli
Option 2: Global Installation (Recommended)
Run the following command in your terminal (you may be prompted to enter your system password if using sudo
):
sudo npm install -g @google/gemini-cli
Once installed, just type gemini
in your terminal to launch the interactive CLI. On the first run, it may request some permissions — simply confirm to proceed.
First-Time Setup
Upon launch, the CLI will guide you through the following steps:
Step 1: Choose a Theme
Select a preferred theme style from the options provided. Hit Enter to confirm.
Step 2: Sign-In Method
Choose a login method. We recommend "Login with Google", which allows up to 60 requests/minute and 1,000 requests/day for free. Select it and hit Enter.
If you need higher rate limits or enterprise access, you can use an API key:
Obtain your API key from Google AI Studio.
Set it as an environment variable:
export GEMINI_API_KEY="YOUR_API_KEY"
Note: Using an API key is typically for direct API calls — this guide focuses on the CLI experience. You can learn more about Gemini API in this guide: Guide: What is Google Gemini API and How to Use It?
Step 3: Browser Authentication
After selecting your sign-in method, a browser window will open. Simply log in with your Google account.
After Login
Once authenticated, you’ll see a confirmation message like this:
Getting Started
You can now enter prompts directly in the CLI. For example:
To upload and reference local files, use @
in the CLI to trigger file selection:
Using Gemini CLI in VSCode
Try running gemini
directly in VSCode’s integrated terminal. After that, use the @
command to select a file and begin a conversation.
For example:
Help me write a simple calculator
The CLI might request "write access" during the process — just confirm. Here's the (slightly ugly) result:
Tips & Tricks
If your connection is unstable, Gemini CLI may automatically fall back from the gemini-2.5-pro
model to the faster gemini-2.5-flash
model.
To discover available commands and usage tips, type /
in the CLI.
Gemini CLI is a powerful AI companion for developers, DevOps engineers, and data analysts. It simplifies code analysis, automates workflows, and supports creative generation — all via natural language instructions.
Bonus: A Must-Have Tool for API Development – Apidog
Alongside Gemini CLI, there’s another powerful productivity tool for developers: Apidog.
Apidog is an all-in-one platform for API documentation, API debugging, API design, API testing, mocking, and automation. It streamlines your entire API workflow — making it one of the best tools to boost development efficiency.
If you’re actively building and testing APIs, give Apidog a try. Signing up is easy — just register [here].
After registering, explore the official demo projects. They’re carefully crafted to help you get up to speed with Apidog’s core features.
A major benefit of Apidog is its full compatibility with Postman and Swagger formats. If you’ve used those tools before, importing your existing data will be effortless. The intuitive interface also makes it beginner-friendly — even first-time users can get started quickly.