📖 Introduction

Gemini CLI is the official command-line AI coding assistant from Google. It runs in your terminal and supports code assistance, file operations, and various development tasks.

Gemini CLI is pre-installed in Cloud Shell and Cloud Workstations, and also supports local installation.

⚙️ System Requirements

Component Requirement Notes
Operating System macOS 15+ / Windows 11 24H2+ / Ubuntu 20.04+ Supports mainstream operating systems
Node.js v20.0.0 or higher Required for npm installation
Memory 4GB+ (normal) / 16GB+ (large projects) Adjust based on usage scenario
Shell Bash / Zsh / PowerShell -

🖥️ Choose Your Platform

Install via npm

Terminal
# Install globally npm install -g @google/gemini-cli # Verify installation gemini --version

Install via Homebrew

Terminal
# Install via Homebrew brew install gemini-cli # Verify installation gemini --version

Install via MacPorts

Terminal
sudo port install gemini-cli

Configure and Run

Terminal
# Run Gemini CLI gemini # First run will prompt for authentication
💡 Using BeeHears Integration

By configuring environment variables, you can use BeeHears unified API access service:

Configure BeeHears Service
export GEMINI_API_KEY="your-beehears-api-key" export GEMINI_API_BASE="https://api.beehears.com/v1" gemini

Install via npm

PowerShell or CMD
# Install globally npm install -g @google/gemini-cli # Verify installation gemini --version

Run with npx (no installation required)

Terminal
# Run directly without permanent installation npx @google/gemini-cli

Configure API Key

PowerShell
# Set environment variables $env:GEMINI_API_KEY="your-api-key-here" $env:GEMINI_API_BASE="https://api.beehears.com/v1" # Run gemini
CMD
set GEMINI_API_KEY=your-api-key-here set GEMINI_API_BASE=https://api.beehears.com/v1 gemini
💡 Tip

Windows 11 24H2 or later provides the best experience. Supports both PowerShell and CMD.

Install via npm

Terminal
# Install Node.js (if not installed) curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash - sudo apt-get install -y nodejs # Install Gemini CLI globally npm install -g @google/gemini-cli # Verify installation gemini --version

Install via Homebrew (Linux)

Terminal
# If Linuxbrew is installed brew install gemini-cli

Install via Anaconda

Terminal
# Create and activate environment conda create -y -n gemini_env -c conda-forge nodejs conda activate gemini_env # Install Gemini CLI npm install -g @google/gemini-cli

Configure API Key

Terminal
export GEMINI_API_KEY="your-api-key-here" export GEMINI_API_BASE="https://api.beehears.com/v1" gemini

Run with Docker

Terminal
# Run in a sandbox container docker run --rm -it us-docker.pkg.dev/gemini-code-dev/gemini-cli/sandbox:latest

🚀 Basic Usage

Start an Interactive Session

Terminal
gemini

Common Commands

  • gemini - Start an interactive session
  • gemini "your prompt" - Send a prompt directly
  • gemini --sandbox - Run in a sandbox environment
  • gemini --help - View help

Release Channels

  • stable - Stable release (default), weekly updates
  • preview - Preview release with new features
  • nightly - Daily build
Install Specific Version
# Install preview version npm install -g @google/gemini-cli@preview # Install nightly build npm install -g @google/gemini-cli@nightly