Getting Started with Gemini CLI
Install the open-source Gemini CLI, authenticate with your Google account, and run your first AI-powered coding session in the terminal.
Install the open-source Gemini CLI, authenticate with your Google account, and run your first AI-powered coding session in the terminal.
Gemini CLI is an open-source, terminal-based AI coding assistant from Google. Unlike editor extensions, it runs directly in your shell — you interact with it in an interactive REPL, pass it prompts via flags, or wire it into CI pipelines.
It uses Gemini 2.5 Pro by default, which includes a 1 million token context window. You can load entire codebases, large documentation sets, or multiple log files directly into context.
Key facts:
Three installation methods — choose based on your workflow:
Gemini CLI supports three auth methods:
Run gemini with no arguments. On first run it opens a browser for Google OAuth:
Limits with free OAuth:
These limits are generous enough for most development workflows.
For higher limits or automation, create an API key at aistudio.google.com:
export GEMINI_API_KEY="AIza..."
geminiOr add to your shell profile (~/.zshrc or ~/.bashrc):
echo 'export GEMINI_API_KEY="AIza..."' >> ~/.zshrc
source ~/.zshrcFor enterprise usage with your GCP account:
export GOOGLE_CLOUD_PROJECT="my-project"
export GOOGLE_CLOUD_LOCATION="us-central1"
gemini --vertexRunning gemini (or gemini in a project directory) opens the interactive REPL. The REPL is a persistent conversation — each message has access to the full history.
Gemini CLI has three release channels:
To switch channels:
npm install -g @google/gemini-cli@preview
# or
npm install -g @google/gemini-cli@nightlyThe stable channel is @google/gemini-cli without a tag. Use @preview or @nightly for pre-release builds.
Gemini CLI is installed globally and authenticated with your Google account — free tier gives you 1,000 requests per day with a 1M token context window. The next module covers the built-in tools (file system, shell commands, web fetch, Google Search) and the slash commands that control CLI behavior during a session.