Prerequisites
Before installing Gemini CLI, ensure your Windows system meets the following requirements:
- Windows 10 or later (64-bit)
- PowerShell 5.1 or later
- Active internet connection
- Administrator privileges for installation
Install Scoop
Scoop is a command-line installer for Windows that makes it easy to install and manage software packages.
Step 1: Open PowerShell as Administrator
Right-click on the Start button and select "Windows PowerShell (Admin)" or "Terminal (Admin)".
Step 2: Set Execution Policy
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
Step 3: Install Scoop
irm get.scoop.sh | iex
Install Gemini CLI
Once Scoop is installed, you can easily install Gemini CLI using the following command:
scoop install gemini-cli
This command will download and install the latest version of Gemini CLI along with all necessary dependencies.
API Key Setup
To use Gemini CLI, you need to configure your Google AI API key.
Step 1: Get Your API Key
Visit Google AI Studio to generate your API key.
Step 2: Set Environment Variable
setx GEMINI_API_KEY "your-api-key-here"
Replace "your-api-key-here" with your actual API key. You may need to restart your terminal for the environment variable to take effect.
Verification
Verify that Gemini CLI is installed correctly by running:
gemini --version
Test the CLI with a simple command:
gemini chat "Hello, how are you?"
Troubleshooting
Common Issues
Command not found
If you get a "command not found" error, restart your terminal or run:
refreshenv
API Key Issues
Make sure your API key is correctly set and has the necessary permissions. You can check if the environment variable is set by running:
echo $env:GEMINI_API_KEY