Gemini CLI lets you access Google’s Gemini AI models directly from your terminal. It works across Windows, macOS, and Linux and fits perfectly into developer workflows for coding, debugging, automation, and research.

This guide shows the exact steps to install Gemini CLI, run it on your system, and choose the right installation method for your setup.
System Requirements (Check Before Installing)
Make sure your system meets these basics:
- OS
- Windows 11 (24H2 or newer)
- macOS 15+
- Ubuntu 20.04+
- Runtime: Node.js 20.0.0 or newer
- Shell: Bash or Zsh
- RAM:
- 4 GB (light usage)
- 16 GB+ (large codebases, long sessions)
- Internet: Required
If Node.js is missing, install it first from the official Node.js site.
Method 1: Install Gemini CLI Using npm (Recommended)
This method works on Windows, macOS, and Linux.
- Open Terminal (or PowerShell on Windows).
- Run this command:
npm install -g @google/gemini-cli
- Verify installation:
gemini --help
If the help menu appears, the installation succeeded.
Method 2: Install with Homebrew (macOS & Linux)
If you already use Homebrew:
brew install gemini-cli
Then start the CLI:
gemini
Method 3: Install with MacPorts (macOS Only)
For MacPorts users:
sudo port install gemini-cli
Method 4: Install with Anaconda (Restricted Environments)
Use this option if your system restricts global npm installs.
conda create -y -n gemini_env -c conda-forge nodejs
conda activate gemini_env
npm install -g @google/gemini-cli
Run Gemini CLI (Basic Usage)
Start Gemini in your current folder:
gemini
Ask a direct question:
gemini -p "Explain this codebase"
Use it inside scripts (non-interactive mode):
gemini -p "Generate release notes" --output-format json
Run Gemini CLI Without Installing (npx Method)
If you want to test it without installing anything:
npx @google/gemini-cli
This method runs the latest version instantly.
Use Gemini CLI in a Secure Sandbox (Docker)
Run Gemini CLI inside a container for isolation:
docker run --rm -it us-docker.pkg.dev/gemini-code-dev/gemini-cli/sandbox:0.1.1
If Gemini CLI is already installed locally, force sandbox mode:
gemini --sandbox -y -p "Your prompt here"
Sign In and Authenticate
When you run gemini for the first time, the CLI prompts you to sign in.
Option 1: Google Account (Best for Individuals)
- No API key required
- Free tier available
- Automatic model updates
Just run:
gemini
Then complete the browser login.
Option 2: Gemini API Key
export GEMINI_API_KEY="YOUR_API_KEY"
gemini
Option 3: Vertex AI (Enterprise)
export GOOGLE_API_KEY="YOUR_API_KEY"
export GOOGLE_GENAI_USE_VERTEXAI=true
gemini
Which Gemini CLI Version Is Right for You?
- Stable (default): Best for most users
npm install -g @google/gemini-cli@lates
- Preview: Test upcoming features
npm install -g @google/gemini-cli@preview
- Nightly: Daily builds (may be unstable)
npm install -g @google/gemini-cli@nightly
Common Installation Issues (Quick Fixes)
geminicommand not found: Restart your terminal or check npm global path.- Node version too old: Upgrade Node.js to v20+.
- Permission errors: Use Anaconda method or fix npm permissions.
Gemini CLI gives you fast, terminal-first access to Gemini models for coding, research, and automation. Install it once, authenticate, and it becomes part of your daily developer workflow—no browser tabs required.
