ClawKit Logo
ClawKitReliability Toolkit

Fix OpenClaw: Gemini CLI Not Detected

โ—‡ Gemini CLI OAuth failed
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.

Related report: openclaw/openclaw#29539 (Google Gemini CLI OAuth error).

Next Step

Fix now, then reduce repeat incidents

If this issue keeps coming back, validate your setup in Doctor first, then harden your config.

Step 1: Install Gemini CLI

If Gemini CLI is not yet installed:

Install Gemini CLI
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 npm global bin and add to PATH
# 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-run Gemini CLI authentication
# 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:

Restart OpenClaw gateway
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.

Configure Gemini via API key in openclaw.json
{
  "model": "google/gemini-2.0-flash",
  "credentials": {
    "google": {
      "apiKey": "YOUR_GOOGLE_AI_STUDIO_KEY"
    }
  }
}

Verify OpenClaw Detects Gemini

Check Gemini is available in OpenClaw
# 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.

Did this guide solve your problem?