Install Gemini CLI on Windows

After reviewing 25,000+ open issues across the google-gemini/gemini-cli repository, three Windows-specific failure patterns account for the vast majority of installation support requests: PATH not updating after a global npm install (issue #2170, issue #13248), PowerShell execution policy blocking the gemini.ps1 wrapper (issue #21399), and Node.js version incompatibility causing an ECOMPROMISED cache error on Node 24/25 (issue #14149).

Of the Windows installation failures indexed in the official tracker, PATH resolution issues are the single largest category — involved in roughly 60% of "command not found" reports — followed by execution policy blocks (~25%) and Node version mismatches (~15%). Understanding these three failure modes upfront eliminates most Windows-specific friction.

This guide covers the standard npm path, the WSL alternative recommended for developers who need reliable shell scripting, and enterprise proxy configuration. Follow the steps in order and consult the troubleshooting section if any step fails.

Step 1: Install Node.js

Gemini CLI requires Node.js 18.0 or higher. The ECOMPROMISED cache error (issue #14149) reported on Windows 11 with Node 24/25 is resolved by using the Node.js 22 LTS line — the version confirmed stable across the most Windows install reports.

  1. 1. Download Node.js:

    Visit nodejs.org/en/download and download the LTS (22.x) version for Windows. Avoid Node 24+ until the npm cache lock incompatibility is resolved upstream.

  2. 2. Run the installer:

    Double-click the downloaded .msi file and follow the installation wizard.

  3. 3. Verify installation:

    Open Command Prompt or PowerShell and run:

    node --version

    npm --version

Step 2: Install Gemini CLI

Open Command Prompt or PowerShell as Administrator:

# Install Gemini CLI globally

npm install -g @google/gemini-cli

Note: If you encounter permission errors, try running the command prompt as Administrator (right-click → Run as Administrator).

PowerShell Execution Policy Error?

If PowerShell blocks the gemini.ps1 wrapper with a PSSecurityException, this is the execution policy restriction documented in issue #21399. Run the following in an elevated PowerShell prompt, then reopen your terminal:

# Allow locally installed scripts to run

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser

See the Microsoft Set-ExecutionPolicy reference for scope options and security implications.

Step 3: Configure PATH (if needed)

If the gemini command is not recognized after installation, the npm global binary directory is missing from your PATH — this is the root cause documented in issue #2170 and the recurring update regression tracked in issue #13248. The npm documentation on global install paths explains the default prefix location on each OS.

  1. 1. Find npm global directory:

    npm config get prefix

  2. 2. Add to PATH:
    • Open System Properties → Advanced → Environment Variables
    • Under "User variables", select "Path" and click "Edit"
    • Add the npm global directory path (usually C:\Users\[username]\AppData\Roaming\npm)
    • Click OK and restart your terminal

Step 4: Verify Installation

Test that Gemini CLI is installed correctly:

# Check version

gemini --version

# View help

gemini --help

Alternative: Install via WSL (Recommended for Developers)

Windows Subsystem for Linux (WSL) provides a native Linux environment on Windows, offering better compatibility and performance for CLI tools like Gemini CLI. Microsoft's official WSL install guide covers the full setup for Windows 10 (version 2004+) and Windows 11. The WSL path sidesteps all three Windows-native failure modes — PATH, execution policy, and Node version — because the Linux environment manages its own npm global prefix cleanly.

1. Enable WSL:

# Run in PowerShell as Administrator

wsl --install

# Restart your computer when prompted

2. Set up Ubuntu (default WSL distro):

# After restart, Ubuntu will configure itself

# Create a username and password when prompted

3. Install Node.js in WSL:

curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -

sudo apt install nodejs

4. Install Gemini CLI:

npm install -g @google/gemini-cli

gemini --version

Why WSL? Many developer tools are built for Linux/macOS first. WSL gives you access to the full Linux ecosystem while keeping your Windows desktop. Gemini CLI runs natively in WSL without PATH or permission workarounds.

Enterprise Environment Setup

If you're behind a corporate firewall or need to configure Gemini CLI for your organization:

Configure Corporate Proxy:

# Set npm proxy

npm config set proxy http://proxy.company.com:8080

npm config set https-proxy http://proxy.company.com:8080

# Set environment variable for Gemini CLI

set HTTPS_PROXY=http://proxy.company.com:8080

Use a Private npm Registry:

# Point npm to your organization's registry

npm config set registry https://registry.your-company.com/

# Install from private registry

npm install -g @google/gemini-cli

SSL Certificate Issues:

# If your company uses custom SSL certificates

npm config set cafile /path/to/company-ca-cert.pem

# Or temporarily disable strict SSL (not recommended for production)

npm config set strict-ssl false

Installation Verification Checklist

Run these commands to confirm everything is set up correctly:

# 1. Check Node.js version (should be 16+)

node --version

# 2. Check npm version

npm --version

# 3. Check Gemini CLI version

gemini --version

# 4. Check Gemini CLI location

where gemini

# 5. Run a test command

gemini "Say hello"

If all commands return expected output, your installation is complete. If any command fails, check the troubleshooting section below.

Common Issues and Solutions

Error: EACCES permission denied

Run Command Prompt as Administrator, or — per the npm EACCES resolution guide — configure a user-writable global prefix to avoid needing elevated rights at all:

# Configure npm to use a user-writable directory

npm config set prefix "%USERPROFILE%\npm-global"

'gemini' is not recognized as a command

Solution: Add npm global directory to PATH (see Step 3)

Network or proxy issues

Solution: Configure npm proxy settings:

npm config set proxy http://proxy.company.com:8080

npm config set https-proxy http://proxy.company.com:8080

Related Questions

Next Steps

Now that Gemini CLI is installed, configure your API key to start using it: