Google Gemini CLI: Installation Guide and Comparison with Claude Code
Prerequisites: Node.js 20+, terminal familiarity, Google account. Time to complete: ~15 minutes. Sources: Google Blog Announcement, GitHub Repository, Official Documentation
What Google Announced
On June 25, 2025, Google released Gemini CLI — an open-source terminal AI agent under the Apache 2.0 license. It brings Gemini 2.5 Pro directly into the command line with a genuinely usable free tier: 1,000 requests per day with a personal Google account.
This matters because terminal coding agents are becoming the primary interface for AI-assisted development. Developers increasingly prefer staying in their terminal rather than switching between browser tabs, desktop apps, or IDE panels.
What Is Gemini CLI?
Gemini CLI is a terminal-first AI agent that provides lightweight access to Google's Gemini models. It is:
- Open source: Apache 2.0 licensed (GitHub)
- Free tier: 60 requests/minute, 1,000 requests/day with a personal Google account
- Terminal-native: Designed for developers who live in the command line
- Extensible: Supports MCP (Model Context Protocol) for custom integrations
- Multimodal: Accepts PDFs, images, and sketches as input
Built-in Tools
- Google Search grounding
- File operations (read, write, edit)
- Shell command execution (with approval)
- Web fetching
- Codebase querying and editing
Context Window
Gemini 2.5 Pro provides a 1 million token context window, enabling analysis of large codebases in a single session.
Installing Gemini CLI
Prerequisites
- Node.js version 20 or higher
- macOS, Linux, or Windows
- Google account (for free tier)
Option 1: Run Without Installation (npx)
npx https://github.com/google-gemini/gemini-cli
Option 2: Install Globally via npm
npm install -g @google/gemini-cli
Option 3: Install via Homebrew (macOS/Linux)
brew install gemini-cli
Option 4: Install via MacPorts
sudo port install gemini-cli
Option 5: Conda Environment
conda create -y -n gemini_env -c conda-forge nodejs
conda activate gemini_env
npm install -g @google/gemini-cli
Verification
gemini --version
Expected output:
gemini-cli x.y.z
Authentication
Free Tier (Personal Google Account)
gemini auth login
This opens a browser window for Google OAuth authentication. No API key required.
Google AI Studio Key (Higher Limits)
gemini auth login --key YOUR_API_KEY
Vertex AI (Enterprise)
gemini auth login --vertex
First Commands
Explain Code
gemini "Explain this function" < src/utils/helper.js
Fix a Bug
gemini "Fix the null pointer exception in auth.js"
Generate Code
gemini "Create a React component for a user profile card with TypeScript"
Analyze Project Structure
gemini "Analyze this codebase and suggest improvements for error handling"
Multimodal Input (Image)
gemini "Convert this wireframe to React code" < wireframe.png
Working With Existing Projects
Laravel Example
cd ~/projects/my-laravel-app
gemini "Find all N+1 query problems in this codebase"
gemini "Generate a migration for a user preferences table with JSON column"
React Example
cd ~/projects/my-react-app
gemini "Refactor this component to use React hooks instead of class components"
gemini "Add TypeScript types to this file" < src/components/Form.js
API Example
gemini "Generate OpenAPI documentation from these route handlers"
gemini "Create curl commands to test all endpoints in this API"
MCP Support
What Is MCP?
MCP (Model Context Protocol) is an open standard for connecting AI agents to external tools and data sources. Think of it as a plugin system for AI agents.
Why It Matters
MCP allows Gemini CLI to connect to:
- Databases (PostgreSQL, MySQL)
- Version control (GitHub, GitLab)
- Cloud services (AWS, GCP, Azure)
- Internal company APIs
- Custom business tools
Real Example: Database Integration
# Install MCP server for PostgreSQL
npm install -g @modelcontextprotocol/server-postgres
# Configure Gemini CLI to use it
gemini mcp add postgres --command "mcp-server-postgres --connection-string postgresql://localhost/mydb"
# Query database naturally
gemini "Show me all users who signed up in the last 30 days"
Business Use Case
A small business can connect Gemini CLI to their Shopify store via MCP:
gemini "What were yesterday's sales? Compare to last week."
gemini "Find products with low inventory and draft restock emails."
Gemini CLI vs Claude Code vs Codex CLI
| Feature | Gemini CLI | Claude Code | Codex CLI |
|---|---|---|---|
| License | Apache 2.0 | Proprietary | Proprietary |
| Open source | ✅ Yes | ❌ No | ❌ No |
| Pricing | 1,000 req/day free | $20/month | Usage-based |
| Authentication | Google OAuth | Anthropic API key | OpenAI API key |
| Context window | 1M tokens (Gemini 2.5 Pro) | 200K tokens | 128K tokens |
| Search integration | Google Search | Limited | Web search (beta) |
| MCP support | ✅ Yes | ❌ No | ❌ No |
| Self-hostable | ✅ Yes | ❌ No | ❌ No |
| Best use case | Terminal-first, free tier, extensible | Complex reasoning, large codebases | Desktop automation, Windows |
Advantages
- Free tier is genuinely usable — 1,000 requests/day covers most individual developers
- Open source — inspect code, fork, customize, self-host
- Apache 2.0 license — safe for commercial use
- MCP extensibility — connect to databases, APIs, internal tools
- Google Search grounding — model has access to current information
- 1M token context — analyze large codebases without chunking
- Multimodal — process images, PDFs, sketches alongside code
Limitations
- Requires Google account — no anonymous usage
- Rate limits on free tier — 60/min may throttle heavy workflows
- Newer tool — smaller community than Claude Code or Copilot
- Google ecosystem dependency — authentication tied to Google services
- Limited IDE integration — primarily terminal-based (VS Code extension in development)
- Enterprise features cost — Vertex AI required for organization-wide deployment
- Shell command approval — manual confirmation required for destructive operations
Who Should Use Gemini CLI?
Use Gemini CLI if:
- You prefer terminal workflows
- You want a free tier that covers daily usage
- You need MCP extensibility for custom tools
- You want open-source software under Apache 2.0
- You work with large codebases requiring 1M token context
Consider Claude Code if:
- You need the strongest reasoning for complex architectural decisions
- You have budget for $20/month subscription
- You prioritize reliability over extensibility
- You work primarily in large, complex codebases
Consider Codex CLI if:
- You are already invested in OpenAI ecosystem
- You need Windows desktop integration
- You want usage-based pricing without subscription
- You use GitHub Copilot and want consistency
Final Thoughts
Gemini CLI represents Google's entry into the terminal coding agent space with a genuinely competitive offering. The combination of open-source code, usable free tier, and MCP extensibility makes it attractive for individual developers and technical founders.
The 1,000 request/day free tier is the standout feature — most developers will not hit this limit during normal usage. For comparison, Claude Code requires a $20/month subscription, and Codex CLI charges per token.
The open-source Apache 2.0 license is significant for businesses. You can inspect the code, fork it, modify it for internal use, and deploy it without license concerns.
Start with the free tier using your Google account. Evaluate whether the rate limits constrain your workflow before considering paid options. For most terminal-based development tasks, Gemini CLI provides sufficient capability at zero cost.
Resources
Last updated: June 1, 2026. Pricing and limits subject to change.