◉GEMINI LABJP
●ARGON — gemini-4-argon is generally available as of 10/13, aimed at complex coding, agents, math and science●DEEP RES — deep-research-pro-preview-12-2025 shuts down 10/23, 6 days left. Move to deep-research-preview-04-2026●NANO — gemini-nano-banana-2.1 is GA (10/06). gemini-3.1-flash-image is deprecated with no shutdown date yet●MCP — One write-up cut an 85,000-token tool result to 310 tokens by wrapping it in an ADK FunctionTool●FLASH — gemini-3.7-flash and 3.5-flash now route automatically to newer Flash models (10/08)●NEW — Stop Re-Reading Every Crash Report: Gre…●ARGON — gemini-4-argon is generally available as of 10/13, aimed at complex coding, agents, math and science●DEEP RES — deep-research-pro-preview-12-2025 shuts down 10/23, 6 days left. Move to deep-research-preview-04-2026●NANO — gemini-nano-banana-2.1 is GA (10/06). gemini-3.1-flash-image is deprecated with no shutdown date yet●MCP — One write-up cut an 85,000-token tool result to 310 tokens by wrapping it in an ADK FunctionTool●FLASH — gemini-3.7-flash and 3.5-flash now route automatically to newer Flash models (10/08)●NEW — Stop Re-Reading Every Crash Report: Gre…
Articles/Dev Tools
⟐ Dev Tools/2026-03-30Beginner

Gemini CLI Won't Start or Authenticate? Where to Look First

Fix common Gemini CLI issues including installation failures, authentication errors, and PATH problems with practical solutions.

Gemini CLI9troubleshooting87error resolutionterminal

npm install fails. The auth window never opens. The gemini command you just installed is not found. Most trouble with the Gemini CLI clusters in the setup phase, before you ever run a real prompt.

What follows is organised by area — installation, authentication, PATH, sandboxing, proxies, and rate limits — pairing the error text you will actually see with the fix for it.

Installation Issues

Node.js Version Doesn't Meet Requirements

Gemini CLI requires Node.js 18.0.0 or higher. If you're using an older version, you'll get compatibility errors during installation.

# Check your current Node.js version
node --version
 
# Upgrade Node.js (macOS with Homebrew)
brew upgrade node
 
# Or install the latest version
brew install node

After upgrading, clear the npm cache and reinstall:

npm cache clean --force
npm install -g @google/generative-ai-cli

npm Permission Denied Error

When installing global npm packages, you might see permission errors because npm lacks write access to system directories.

Recommended solution: Configure npm to use a user directory instead of sudo.

# Check npm's current prefix
npm config get prefix
 
# Create and set a user-owned directory
mkdir ~/.npm-global
npm config set prefix '~/.npm-global'
 
# Add to PATH in ~/.bashrc or ~/.zshrc
echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.bashrc
source ~/.bashrc
 
# Now install without issues
npm install -g @google/generative-ai-cli

npm Install Fails with Network Errors

Unstable network connections can interrupt installation mid-process.

# Retry with increased timeout
npm install -g @google/generative-ai-cli --no-audit --legacy-peer-deps
 
# Or switch npm registry mirrors (useful in some regions)
npm config set registry https://registry.npmmirror.com
npm install -g @google/generative-ai-cli

Authentication Issues

API Key Not Recognized

Gemini CLI reads the API key from the GEMINI_API_KEY environment variable. If it's not set or the format is wrong, authentication fails.

# Check if the environment variable is set
echo $GEMINI_API_KEY
 
# If empty, set your API key
export GEMINI_API_KEY='YOUR_GEMINI_API_KEY'
 
# Make it permanent by adding to ~/.bashrc or ~/.zshrc
echo "export GEMINI_API_KEY='YOUR_GEMINI_API_KEY'" >> ~/.bashrc
source ~/.bashrc
 
# Verify the configuration
gemini auth test

Important: Generate your API key from Google AI Studio (https://aistudio.google.com). Never commit API keys to Git or include them in public repositories.

Google Account Authentication Fails

Some operations require communication with Google's servers. If you're behind a proxy, authentication might fail.

# Clear cached credentials
gemini auth clear
 
# Log in again
gemini auth login
 
# If behind a proxy, configure proxy settings
export HTTP_PROXY=http://proxy.example.com:8080
export HTTPS_PROXY=https://proxy.example.com:8080
gemini auth login

Command Not Found Error

PATH Configuration Is Incorrect

The "gemini: command not found" error means the installed command isn't in your system's PATH.

# Check where npm installs global packages
npm config get prefix
 
# Verify PATH includes the installation directory
echo $PATH
 
# If not included, add to ~/.bashrc or ~/.zshrc
export PATH="/usr/local/bin:$PATH"
# Or if npm uses a custom directory:
export PATH="$HOME/.npm-global/bin:$PATH"
 
# Apply changes immediately
source ~/.bashrc

Shell Configuration File Not Applied

On newer macOS versions, zsh is the default shell. Adding settings to bash won't work.

# Check your current shell
echo $SHELL
 
# If using zsh, add to ~/.zshrc instead
echo 'export PATH="$HOME/.npm-global/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc
 
# Open a fresh terminal window to verify
gemini --version

Plan Mode Unavailable

Plan Mode requires a Pro plan subscription in Google AI Studio. Without it, you'll get errors when trying to use Plan Mode.

# Check your account status
gemini status
 
# Verify Pro plan enrollment at:
# https://aistudio.google.com/app/plan

After subscribing to Pro, clear cached credentials and log in again:

gemini auth clear
gemini auth login

For detailed Plan Mode usage, see "[Gemini CLI Plan Mode Guide]((/articles/gemini-dev/gemini-cli-plan-mode)".

Linux-Specific Issues (gVisor Sandbox)

On Linux, gVisor sandbox-related errors may appear, especially when running Plan Mode.

# Check if gVisor is installed (Ubuntu/Debian)
which runsc
 
# If missing, you'll see:
# E: Cannot locate runsc
 
# Install gVisor (Ubuntu 20.04+)
curl -fsSL https://gvisor.dev/archive.key | sudo apt-key add -
sudo add-apt-repository "deb https://storage.googleapis.com/gvisor/releases release main"
sudo apt-get update
sudo apt-get install -y runsc

To skip sandbox requirements, set this environment variable:

export GEMINI_CLI_NO_SANDBOX=1
gemini plan

Network and Proxy Errors

Connection Timeout

Network delays or proxy issues can cause connection timeouts.

# Increase timeout value
export NODE_OPTIONS="--max-old-space-size=4096"
gemini --timeout 60000 plan
 
# Configure proxy settings
export HTTP_PROXY=http://proxy.example.com:8080
export HTTPS_PROXY=https://proxy.example.com:8080
export NO_PROXY=localhost,127.0.0.1
gemini plan

SSL/TLS Certificate Error

Corporate SSL inspection proxies can cause certificate validation failures.

# Allow self-signed certificates (development only)
export NODE_TLS_REJECT_UNAUTHORIZED=0
gemini plan
 
# Better approach: Add corporate CA to system
# Linux
sudo cp /path/to/ca-certificate.crt /usr/local/share/ca-certificates/
sudo update-ca-certificates
 
# macOS
sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain /path/to/ca-certificate.crt

Rate Limit Error (429 Too Many Requests)

A 429 error means you've exceeded your API key's request limit within a time period.

# Check your usage and limits
gemini status
 
# Set retry delay (in milliseconds)
export GEMINI_RETRY_DELAY=5000  # Wait 5 seconds between retries
gemini plan

For more details on rate limiting, see "[Gemini API 429 Error and Quota Troubleshooting]((/articles/gemini-api/gemini-api-quota-429-error-troubleshooting)".

Version Upgrade Troubleshooting

Changes Between v0.34.0 and v0.35.0

Version 0.35.0 modified some configuration file formats. Old config files can cause errors with the new version.

# Check your installed version
gemini --version
 
# Upgrade to the latest
npm install -g @google/generative-ai-cli@latest
 
# Reset configuration
gemini config reset
 
# Clear cache
gemini cache clear

After upgrading, reconfigure your settings:

gemini auth login
gemini config set model gemini-2.5-pro

Setup Verification Script

Use this script to diagnose your entire Gemini CLI setup at once:

#!/bin/bash
# Gemini CLI Setup Diagnostic Script
 
echo "=== Gemini CLI Setup Diagnostic ==="
 
# Check Node.js version
echo -n "Node.js: "
node --version
 
# Check npm version
echo -n "npm: "
npm --version
 
# Check Gemini CLI installation
echo -n "Gemini CLI: "
if command -v gemini &> /dev/null; then
  gemini --version
else
  echo "Not installed"
  exit 1
fi
 
# Check API key configuration
if [ -z "$GEMINI_API_KEY" ]; then
  echo "Warning: GEMINI_API_KEY environment variable not set"
else
  echo "API Key: Configured (first 10 chars: ${GEMINI_API_KEY:0:10}...)"
fi
 
# Verify PATH
echo -n "gemini in PATH: "
which gemini
 
# Run functionality tests
echo "--- Feature Tests ---"
gemini auth test && echo "Authentication: OK" || echo "Authentication: FAILED"

Run this script to quickly identify which component needs attention.

Next Steps

Once your setup is complete, explore these guides:

  • [Gemini CLI Complete Guide]((/articles/gemini-dev/gemini-cli-guide) — In-depth command reference and configuration options
  • [Gemini CLI Plan Mode Guide]((/articles/gemini-dev/gemini-cli-plan-mode) — Advanced planning features

Resources

If your issue persists, reach out to the Google AI Studio community forums for support.

Share

Thank You for Reading

Gemini Lab is ad-free, supported entirely by members like you. We publish practical guides daily with implementation code, benchmarks, and production-ready patterns. If you've found it useful, we'd love to have you on board.

  • ✦Copy-paste ready implementation code
  • ✦New advanced guides published daily
  • ✦$5/mo or $10 for lifetime access
View Membership →

If you found this article helpful, a small tip ($1.50) would mean a lot to us. Your support helps keep this site ad-free and covers server and hosting costs.

Related Articles

⟐ Dev Tools2026-09-29
Gemini CLI Kept Saying 'API key not valid' After I Gave It a New Key — It Was Reading an Old One From a Third Place
I switched Gemini CLI from Google login to a paid API key, and the 400 'API key not valid' error would not go away. The key can come from four places — the shell, a project .env, a home .env, and settings.json — and a short script that lights them up in order narrows the cause to one.
⟐ Dev Tools2026-09-21
The Day I Unplugged an MCP Server for the First Time — How I Decide Which Tools Stay On
Keep adding MCP servers and quality degrades well before you hit the API ceiling of 512 function declarations. Here is how I use includeTools and excludeTools in Gemini CLI to decide which tools stay enabled, and how I put the rest away.
⟐ Dev Tools2026-05-23
LM Studio 'Failed to Load Model' for Gemma 4 MLX — A 4-Bucket Diagnostic for Apple Silicon
When LM Studio refuses to load mlx-community/gemma-4-26b-a4b-it-4bit with a red 'Failed to load model' dialog, the cause is almost always one of four buckets. Here's how to triage them on an Apple Silicon Mac in under thirty minutes.