GC-101 · Module 1
Getting Started
4 min read
Gemini CLI is Google's open-source AI coding agent that runs directly in your terminal. It connects to Gemini models — including Gemini 2.5 Pro with its massive 1 million token context window — and gives you an agentic coding assistant that can read files, write code, run shell commands, and search the web. The project is fully open-source under the Apache 2.0 license on GitHub at google-gemini/gemini-cli.
Installation is straightforward. The fastest path is via npm:
npm install -g @anthropic-ai/gemini-cli
But most developers prefer npx for zero-install usage — just run npx https://github.com/google-gemini/gemini-cli and you're in. Homebrew users on macOS can tap into it, and Conda environments are supported for data science workflows. If you don't want to install anything at all, Google Cloud Shell comes with Gemini CLI pre-installed — zero setup, just open a browser.
# Option 1: Global install via npm
npm install -g @google/gemini-cli
gemini
# Option 2: Run without installing (npx)
npx https://github.com/google-gemini/gemini-cli
# Option 3: Google Cloud Shell (zero install)
# Just open shell.cloud.google.com — Gemini CLI is pre-installed
Authentication supports two paths. For personal use, sign in with your Google account — Gemini CLI uses the same free tier as the Gemini API, giving you generous rate limits at no cost. For enterprise or higher-throughput needs, set a GEMINI_API_KEY environment variable pointing to a key from Google AI Studio (aistudio.google.com). The Google account path is the easiest way to start — it walks you through an OAuth flow right in the terminal.
# Authenticate with Google account (interactive)
gemini
# Follow the OAuth prompt in your browser
# Or use an API key
export GEMINI_API_KEY="your-key-from-aistudio"
gemini
Gemini CLI works across multiple surfaces. The primary experience is the standalone terminal CLI. But the same engine also powers Gemini Code Assist's agent mode in VS Code, and runs inside Google Cloud Shell for browser-based development. All three surfaces share the same underlying capabilities — the difference is just the interface layer.
Do This
- Start from your project root so GEMINI.md files load correctly
- Use Google account auth for personal projects (free tier)
- Try Cloud Shell first if you want zero-setup exploration
Avoid This
- Run from a subdirectory and wonder why context is missing
- Pay for API keys before exploring whether the free tier meets your needs
- Spend 20 minutes on local setup when Cloud Shell gets you started in 30 seconds