Fix OpenClaw: Gemini CLI Not Detected
Error: Cannot find 'gemini' in PATH
OpenClaw uses the gemini CLI binary to authenticate with Google AI via OAuth. If the binary is not on your system PATH โ or if the stored OAuth token has expired โ OpenClaw reports "Gemini CLI OAuth failed" and cannot use Gemini models. This guide walks through every fix.
Next Step
Fix now, then reduce repeat incidents
If this issue keeps coming back, validate your setup in Doctor first, then harden your config.
Jump to Fix
Step 1: Install Gemini CLI
If Gemini CLI is not yet installed:
npm install -g @google/gemini-cli # Verify gemini --version
Step 2: Add gemini to PATH
The most common cause of non-detection is that the npm global bin directory is not on PATH. Check where npm installs global binaries:
# Find where npm global binaries are installed npm config get prefix # The bin directory is usually <prefix>/bin on macOS/Linux # Add it to your shell profile (~/.zshrc or ~/.bashrc): export PATH="$(npm config get prefix)/bin:$PATH" # Reload: source ~/.zshrc # or ~/.bashrc # Verify gemini is now found: which gemini gemini --version
macOS with Homebrew Node.js: If you installed Node via Homebrew, the global prefix is usually /opt/homebrew. Run echo $(brew --prefix)/bin and add that to PATH instead.
Step 3: Re-run OAuth Authentication
Even if the binary is on PATH, the OAuth token may be expired. Re-authenticate:
# Re-authenticate (opens browser) gemini auth login # Verify auth succeeded gemini auth status
After authentication, restart the OpenClaw gateway so it picks up the new credentials:
openclaw gateway restart
Alternative: Use API Key Instead of CLI
If you prefer not to use the CLI OAuth flow, you can authenticate directly with a Google AI Studio API key. Get your key at aistudio.google.com/apikey.
{
"model": "google/gemini-2.0-flash",
"credentials": {
"google": {
"apiKey": "YOUR_GOOGLE_AI_STUDIO_KEY"
}
}
}Verify OpenClaw Detects Gemini
# Run OpenClaw config check openclaw config check # Or run the diagnostics tool npx clawkit-doctor@latest
When OpenClaw detects Gemini CLI correctly, you should see the available Gemini models in the model selector, and the gateway log should show no OAuth errors on startup.
Related model & auth issues
Fix It Faster With Our Tools
Did this guide solve your problem?