Introduction
Following the trend of CLI agents, I installed Gemini CLI this time.
There are surprisingly many installation methods. Environment:
- macOS (Tahoe 26)
- Node.js 22
Table of Contents
Installation Methods
Three main installation methods available.
Homebrew (Easy)
brew install gemini-clinpm Global Install (Node.js 20+)
npm install -g @google/gemini-clinpx for Trial
npx https://github.com/google-gemini/gemini-cliAuthentication
Gemini CLI supports 3 authentication methods. Most people will use Google login.
Google Login
gemini
# Follow on-screen instructions to log in via browserNote: If under 18 or using Workspace account, you may need Google Cloud Project ID. Google, please be more lenient
export GOOGLE_CLOUD_PROJECT="YOUR_PROJECT_ID"Gemini API Key (AI Studio)
Get API key and set as environment variable:
export GEMINI_API_KEY="YOUR_API_KEY"Vertex AI
export GOOGLE_GENAI_USE_VERTEXAI=true
export GOOGLE_API_KEY="YOUR_API_KEY"Don’t forget to reload shell config after writing to config file.
Usage
Useful options to know:
# First command to try
gemini
# Non-interactive mode
gemini -p "Hello from macOS"
# Want to use Flash? (Change model)
gemini -m gemini-2.5-flash -p "Summarize this project structure"Update & Uninstall
How to remove when needed:
# brew
brew upgrade gemini-cli # Update
brew uninstall gemini-cli # Uninstall
# npm
npm update -g @google/gemini-cli # Update
npm uninstall -g @google/gemini-cli # UninstallTroubleshooting
“command not found: gemini”
Brew:
brew doctor→brew reinstall gemini-clinpm: Verify PATH includes
npm prefix -gecho 'export PATH="$(npm prefix -g)/bin:$PATH"' >> ~/.zshrc source ~/.zshrc
Authentication fails
- Check Google account permissions
- Verify API key validity
- Ensure Project ID is set (if required)
Browser doesn’t open (can’t log in)
- For headless/SSH environments, use API key method
Usage Limits
- Google Login (personal): Approximately 60 requests/min · 1,000 requests/day free tier.
- Gemini API Key (AI Studio): Free tier 100 requests/day (varies by model and time).
References
- GitHub (Authentication)
- Pricing/Limits (Gemini API Pricing)

