Gemini CLI: AI Agent for Your Terminal
Gemini CLI puts a Gemini-powered agent straight into your terminal, with shell commands, file edits, and Google Search grounding built in rather than bolted on. Reach for it if you're already on a Google account and want a free, terminal-native coding assistant; skip it if you need multi-provider models or session memory that persists without manual checkpoints.
Bringing Gemini to Your Terminal
Gemini CLI is Google's open-source TypeScript agent that runs as a command you type β gemini β dropping a Gemini-powered assistant directly into your shell. It reads and edits files, executes shell commands, fetches web pages, and grounds answers in live Google Search results, all inside the same terminal session you already use for git and npm.
Core Features and Built-in Tools
- βFree OAuth tier: 60 requests/minute and 1,000 requests/day on a personal Google account, with access to Gemini 3 models and a 1M token context window β no API key to manage.
- βBuilt-in shell execution, file system operations, and web fetching, so Gemini CLI can read a file, run a test, and act on the output without leaving the terminal.
- βGoogle Search grounding pulls live results into answers instead of relying only on training data.
- βMCP client and server support lets you wire in custom tools β the README shows examples like @github, @slack, and @database commands once a server is configured in ~/.gemini/settings.json.
- βGEMINI.md files hold project-specific context and instructions that persist across a session.
- βConversation checkpointing saves and resumes a session, useful for a debugging run you can't finish in one sitting.
- βThe Gemini CLI GitHub Action runs PR reviews, issue triage, and on-demand help when someone mentions @gemini-cli in an issue or pull request.
- βThree release channels β nightly, preview, and stable β ship on a fixed weekly cadence instead of an ad hoc schedule.
Practical Applications for Development
- β’Querying and editing a large codebase in natural language instead of grepping through files by hand.
- β’Generating a new app from a sketch, PDF, or image using Gemini's multimodal input.
- β’Automating operational chores β the README specifically calls out querying open pull requests and handling complex rebases.
- β’Running Gemini CLI non-interactively inside a CI script with gemini -p "..." --output-format json to get structured output a pipeline can parse.
- β’Wiring in MCP servers for tasks outside the built-in tools, like generating media through Imagen, Veo, or Lyria via a connected server.
How to Install Gemini CLI
Run npx @google/gemini-cli to try it with no install, or npm install -g @google/gemini-cli for a global command. macOS and Linux users can also run brew install gemini-cli, and macOS has a MacPorts path too: sudo port install gemini-cli. Restricted environments without npm access get an Anaconda workaround β create a conda environment with nodejs, then npm install -g @google/gemini-cli inside it. To pin a channel instead of the default stable release, install with an explicit tag: npm install -g @google/gemini-cli@preview or @nightly. Preview builds ship weekly on Tuesdays at 23:59 UTC, stable promotes last week's preview (plus fixes) at 20:00 UTC the same day, and nightly rebuilds from main every day at 00:00 UTC.
Basic Interaction and Scripting
Type gemini in a project directory to start an interactive session, or add --include-directories ../lib,../docs to bring extra folders into context. Pick a model with -m gemini-2.5-flash. For scripts, skip the interactive prompt entirely: gemini -p "Explain the architecture of this codebase" returns plain text, add --output-format json for structured output a script can parse, or --output-format stream-json to stream newline-delimited events while a long task runs.
Authentication Options for Different Needs
Individual developers signing in with a personal Google account get OAuth: no API key to manage, automatic model updates, and the same free tier (60 req/min, 1,000 req/day) as anyone else on that path. Developers who want to pick a specific Gemini model or move to paid usage-based billing should use a Gemini API key instead β it also ships a 1,000 requests/day free tier on a mix of Gemini 3 flash and pro. Enterprise teams running production workloads want Vertex AI, trading simpler setup for Google Cloud billing, higher rate limits, and compliance features.
Strengths
- βFree entry: OAuth sign-in with a personal Google account costs nothing and needs no credit card or API key setup.
- βEverything happens in the terminal β no switching to a browser tab to paste code back and forth.
- βMCP support means you're not limited to the built-in tools; connect a GitHub, Slack, or database server and reference it with an @ mention.
- βGoogle Search grounding means answers can cite live results instead of stale training data.
- βThe GitHub Action brings the same agent into pull request reviews and issue triage without a separate integration.
- βThree release channels (nightly, preview, stable) let you pick how much risk you want in exchange for how new the code is.
Understanding Usage Tiers and Release Stability
- β³Every auth path routes through Google β OAuth needs a Google account, the API key comes from Google AI Studio, and Vertex AI needs a Google Cloud project. There's no generic third-party-model key.
- β³Conversation checkpointing has to be triggered and resumed manually β Gemini CLI doesn't keep session memory alive across restarts on its own.
- β³The free OAuth tier's 60 requests/minute and 1,000/day cap can get tight fast in a large monorepo or a busy CI pipeline.
- β³It runs shell commands and edits files directly, so a session is only as safe as the trust you put in it; Trusted Folders scope that but add configuration to set up.
- β³Node.js is required to run it at all β restricted environments without npm access need the Anaconda workaround instead of a straight install.
Finding Similar Command-Line AI Tools
Frequently Asked Questions
Gemini CLI is free through OAuth sign-in with a personal Google account, capped at 60 requests per minute and 1,000 requests per day β no credit card or API key required to start.
Gemini CLI gives OAuth and API-key users access to Gemini 3 models, including a 1M token context window; the API key path uses a mix of Gemini 3 flash and pro on its free tier.
Run npx @google/gemini-cli to try it with no install, npm install -g @google/gemini-cli for a global command, or brew install gemini-cli on macOS and Linux.
Gemini CLI supports non-interactive scripting: gemini -p "your prompt" runs headless and returns text, and --output-format json or stream-json give a script parseable output.
MCP (Model Context Protocol) support lets Gemini CLI connect to external servers for custom tools β configured in ~/.gemini/settings.json, then called with an @ mention like @github or @slack.
Gemini CLI is released under the Apache-2.0 license, a permissive open-source license covering the whole Gemini CLI project on GitHub.
The problem it solves
Terminal-based coding often means bouncing between a browser tab for AI help and a shell for the actual work β copy a snippet out, paste an answer back in, lose the file context every time. Gemini CLI's fix is running the agent as a shell command that already has file system, shell, and web-fetch access, so the model reads your actual repo and runs commands instead of you relaying context back and forth by hand.
