Installation Guide
Get Gemini CLI up and running on your system with our step-by-step installation guide. Choose the method that works best for your environment.
System Requirements
Make sure your system meets these requirements
Windows
- Windows 10 or later
- Node.js 18.0.0 or higher
- PowerShell 5.1 or PowerShell Core 7+
- Windows Terminal (recommended)
macOS
- macOS 10.15 (Catalina) or later
- Node.js 18.0.0 or higher
- Xcode Command Line Tools
- Terminal or iTerm2
Linux
- Ubuntu 18.04+ / CentOS 8+ / Debian 10+
- Node.js 18.0.0 or higher
- curl or wget
- bash or zsh shell
Installation Methods
Choose the installation method that best fits your needs
NPM Installation
Recommended method for most users
Step 1: Install globally via npm
This installs Gemini CLI globally on your system
npm install -g @google/generative-ai-cliStep 2: Verify installation
Check that the installation was successful
gemini --versionStep 3: Set up API key
Configure your Google AI API key
gemini config set api-key YOUR_API_KEYDocker Installation
Containerized environment for consistent deployment
Step 1: Pull the Docker image
Download the official Docker image
docker pull google/gemini-cli:latestStep 2: Run with API key
Start a container with your API key
docker run -e GEMINI_API_KEY=your_key google/gemini-cli:latestStep 3: Interactive mode
Start an interactive chat session
docker run -it -e GEMINI_API_KEY=your_key google/gemini-cli:latest chatFrom Source
Build from source code for development
Step 1: Clone repository
Get the source code from GitHub
git clone https://github.com/google-gemini/gemini-cli.gitStep 2: Install dependencies
Install all required dependencies
cd gemini-cli && npm installStep 3: Build and link
Build the project and create global symlink
npm run build && npm linkAPI Key Configuration
Set up your Google AI API key to start using Gemini CLI
Get Your API Key
- 1Visit Google AI Studio
- 2Sign in with your Google account
- 3Click "Create API Key" and copy the key
Configure the Key
Using CLI command:
gemini config set api-key YOUR_API_KEYUsing environment variable:
export GEMINI_API_KEY=YOUR_API_KEYVerify Installation
Test your installation to make sure everything is working
Check Version
gemini --versionShould display the installed version number
Test API Connection
gemini ask "Hello, can you hear me?"Should return a response from Gemini
Check Configuration
gemini config listShould show your current configuration settings
Common Issues
Solutions to common installation problems
Command not found
If you get "command not found" after installation, your PATH may not include npm's global bin directory.
npm config get prefixAdd the bin directory to your PATH in your shell profile (.bashrc, .zshrc, etc.)
Permission denied
On macOS/Linux, you might need to use sudo or configure npm to use a different directory.
npm config set prefix ~/.npm-globalNext Steps
Now that Gemini CLI is installed, explore these resources