How to Install Gemini CLI on Linux
Updated for June 26 2025 — this guide explains how to install and configure Google's Gemini CLI on popular Linux distributions, including Ubuntu/Debian, Fedora/RHEL, Arch, and universal Snap packages.
1. Prerequisites
- 64-bit Linux distro released 2019 or later (kernel 5.x+ recommended)
- Node.js 18 LTS or newer (check with
node -v
) - npm 9+ or alternative manager (
npm -v
) curl
&git
installed for convenience- Sudo/root privileges for system-wide installs
2. Installation Methods
Method A — npx (No Install)
npx https://github.com/google-gemini/gemini-cli
Perfect for a quick demo; nothing persists after exit.
Method B — Ubuntu / Debian (apt)
# Add NodeSource repo & install Node.js 18 curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash - sudo apt-get install -y nodejs # Install Gemini CLI globally sudo npm install -g @google/gemini-cli # Verify gemini --version which gemini
Method C — Fedora / RHEL / CentOS (dnf/yum)
# Enable NodeSource repo curl -fsSL https://rpm.nodesource.com/setup_18.x | sudo bash - # Install Node.js sudo dnf install -y nodejs npm # use yum on older systems # Install Gemini CLI audo npm install -g @google/gemini-cli
Method D — Arch / Manjaro (pacman)
sudo pacman -Syu nodejs npm --noconfirm sudo npm install -g @google/gemini-cli
Method E — Universal (Snap)
sudo snap install node --classic sudo npm install -g @google/gemini-cli
3. First-Time Setup
- Run
gemini
in the terminal. - Select your preferred theme.
- Choose Login with Google to unlock the generous free tier (60 req/min, 1 000 req/day).
- If the browser callback fails, export
GEMINI_BROWSER=chrome
or use a headless option.
4. Using an API Key
Power users can bypass Google Login with a key from AI Studio:
echo "export GEMINI_API_KEY=YOUR_API_KEY" >> ~/.bashrc # or ~/.zshrc source ~/.bashrc gemini --prompt "Hello from Linux"
5. Quick Start Commands
# Interactive mode gemini # One-shot prompt gemini --prompt "Generate a Dockerfile for Node.js" # Include files gemini "Explain this script" @scripts/deploy.sh
6. Troubleshooting
EACCES Permission Errors
sudo chown -R $(whoami) $(npm config get prefix)/{lib/node_modules,bin,share}
Command Not Found
export PATH="$HOME/.npm-global/bin:$PATH"
Proxy Issues
npm config set proxy http://proxy.example.com:8080 npm config set https-proxy http://proxy.example.com:8080
7. Next Steps
Continue with the Getting Started guide or explore command reference for advanced usage.