Install Gemini CLI with npm install -g @google/gemini-cli (Node 20 or newer), or brew install gemini-cli on macOS and Linux. Windows uses the same npm command in PowerShell. Ubuntu needs a Node from nvm or NodeSource, because the apt package is older than 20 on every LTS through 24.04. After installing, set GEMINI_API_KEY: as of August 2026 personal Google sign-in no longer serves the CLI.
npm install -g @google/gemini-cliis the primary route. Node 20.0.0+.brew install gemini-cliworks but lags npm: 0.46.0 versus 0.54.4 in August 2026.- Windows is the same npm command. There is no separate installer or winget package.
- Ubuntu's
aptNode is too old: 12.22.9 on 22.04, 18.19.1 on 24.04. - Installing is not enough: set
GEMINI_API_KEY, because personal sign-in stopped working on 18 June 2026. - Never
sudo npm install -g. Set a user-writable prefix instead.
Before you install: pick the auth rail first
This is out of order on purpose. Gemini CLI installs cleanly and then fails on the first request if you sign in the way most tutorials still describe.
What to have ready, by situation. Checked August 2026.
| You are | Get this first | Then install |
|---|---|---|
| An individual, any Google AI plan | A Gemini API key from AI Studio | Gemini CLI, or agy |
| On a Google Cloud project | Project id and region for Vertex AI | Gemini CLI |
| On a Workspace Code Assist license | Nothing; your license still works | Gemini CLI |
| Just trying it out | A free API key, 250 requests per day | Gemini CLI |
Requirements
Google's published specifications.
| Item | Requirement |
|---|---|
| Node.js | 20.0.0 or newer |
| macOS | 15 or newer |
| Windows | 11 24H2 or newer |
| Linux | Ubuntu 20.04 or newer |
| Shell | Bash, Zsh, or PowerShell |
| RAM, short sessions | 4 GB |
| RAM, large codebases | 16 GB |
node -v # must be v20.0.0 or higher
npm -v
npm install (every platform)
npm install -g @google/gemini-cli
gemini --version
This is the route Google documents first and the one that gets updates the day they ship. It works identically on macOS, Linux, Windows PowerShell, and WSL.
If it fails with EACCES
A global npm install writing into a root-owned prefix is the classic failure. Do not fix it with sudo: that leaves root-owned files in your npm tree and breaks every later install for your user.
mkdir -p ~/.npm-global
npm config set prefix ~/.npm-global
echo 'export PATH="$HOME/.npm-global/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc
npm install -g @google/gemini-cli
Release channels
npm install -g @google/gemini-cli@latest # stable, weekly on Tuesdays
npm install -g @google/gemini-cli@preview # weekly, unvetted
npm install -g @google/gemini-cli@nightly # daily, from main
Stay on stable unless you are chasing a specific fix. Preview and nightly are explicitly documented as potentially containing regressions.
brew install gemini-cli
brew install gemini-cli
gemini --version
# later
brew upgrade gemini-cli
Homebrew is the tidier option on macOS and Linuxbrew: one command to install, one to upgrade, no npm prefix to reason about. The cost is version lag. In August 2026 the formula was on 0.46.0 while npm shipped 0.54.4, which is roughly two months of releases.
which -a gemini
brew list --versions gemini-cli
npm ls -g @google/gemini-cli
MacPorts
sudo port install gemini-cli
Install on Windows
There is no standalone Windows installer, no winget package, and no MSI. Windows uses npm, which means installing Node first.
Install Node 20 or newer
winget install OpenJS.NodeJS.LTS
# open a NEW PowerShell window, then
node -v
A terminal opened before the Node install will not see it. This is the most common "it says command not found" on Windows and it is not a Gemini CLI problem.
Install the CLI
npm install -g @google/gemini-cli
gemini --version
Set the key so it survives a reboot
$env:GEMINI_API_KEY="YOUR_KEY"
[Environment]::SetEnvironmentVariable("GEMINI_API_KEY","YOUR_KEY","User")
# then open a new terminal
Windows paths worth knowing.
| Thing | Where |
|---|---|
| npm global packages | %AppData%\npm |
The gemini shim | %AppData%\npm\gemini.cmd |
| User config | %UserProfile%\.gemini\ |
WSL
Inside WSL you are on Linux, so follow the Ubuntu instructions below. Do not install once on Windows and once in WSL and expect a shared config: they have separate home directories, so they have separate ~/.gemini directories and separate credentials.
Install on Ubuntu and other Linux
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash
exec $SHELL -l
nvm install 22
nvm use 22
node -v
npm install -g @google/gemini-cli
gemini --version
curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash -
sudo apt-get install -y nodejs
node -v
npm install -g @google/gemini-cli
Homebrew on Linux
brew install gemini-cli
Works, with the same version lag as macOS.
Run it without installing
npx @google/gemini-cli
# straight from main, for testing unreleased work
npx https://github.com/google-gemini/gemini-cli
npx is the right call for a one-off evaluation, a shared build machine, or a locked-down environment where a global install is not allowed. It is the wrong call for daily use: every invocation pays a resolution cost, and the cache is easy to lose.
Container sandbox
Gemini CLI can execute its tools inside a container rather than on your host, which is the isolation model to reach for on a repository you do not fully trust.
gemini --sandbox -y -p "explain this repository"
Anaconda
For restricted environments where you cannot install Node globally but can create a conda environment.
conda create -y -n gemini_env -c conda-forge nodejs
conda activate gemini_env
npm install -g @google/gemini-cli
First run
Export the key
export GEMINI_API_KEY="YOUR_KEY"
echo 'export GEMINI_API_KEY="YOUR_KEY"' >> ~/.zshrc
Start it in the repository root
cd ~/code/your-project
gemini
The working directory becomes the workspace, so launch from the repository root unless you have a reason not to.
Choose Use Gemini API key
Not Sign in with Google. On a personal account that path completes the browser flow and then fails on the first request.
Give it a GEMINI.md
/init
Then trim the generated file down to your real build and test commands. A narrow test command is the single highest-value line in it, because an agent that runs your whole suite on every change burns quota on waiting.
When the install goes wrong
| Symptom | Cause | Fix |
|---|---|---|
gemini: command not found | Shell opened before the install | Open a new terminal, or exec $SHELL -l |
| Still not found in a new shell | npm prefix is not on PATH | npm prefix -g, then add its bin to your profile |
EACCES during install | Root-owned npm prefix | Set a user prefix. Do not use sudo |
| Crashes immediately on launch | Node older than 20 | node -v, then nvm or NodeSource |
| Disappeared after upgrading Node | Global prefix moved with the version | Reinstall under the current Node |
| Installs, then every request fails | Signed in with a personal Google account | Set GEMINI_API_KEY and re-pick the auth method |
| A documented flag is unknown | Homebrew build is behind npm | gemini --version, then brew upgrade or switch to npm |
| Two versions behaving differently | npm and Homebrew both installed | which -a gemini, remove one |
Questions people ask
npm install -g @google/gemini-cli, with Node 20 or newer. On macOS and Linux you can use brew install gemini-cli instead. Then set GEMINI_API_KEY and run gemini in a project directory.
Node.js 20.0.0 or newer. The Homebrew formula depends on Node too, so it does not remove the requirement. Check with node -v before installing.
Install Node with winget install OpenJS.NodeJS.LTS, open a new PowerShell window, then run npm install -g @google/gemini-cli. There is no standalone Windows installer or winget package for the CLI itself.
Do not use the apt nodejs package: it is 12.22.9 on 22.04 and 18.19.1 on 24.04, both below the required Node 20. Install Node 22 with nvm or NodeSource first, then npm install -g @google/gemini-cli.
No. The Homebrew formula lags. In August 2026 it was on 0.46.0 while npm shipped 0.54.4. Use npm if you need current flags, Homebrew if you prefer one upgrade command.
Homebrew and MacPorts both package it, and npx @google/gemini-cli runs it with no permanent install. All of them still require Node on the machine except the container sandbox image.
No. It creates root-owned files in your npm tree that break later installs for your user. Set a user-writable prefix with npm config set prefix ~/.npm-global and add that bin directory to PATH.
If you are an individual developer on a Google AI plan, Antigravity CLI is what Google supports as of August 2026 and it installs with one script. Gemini CLI still makes sense on a Gemini API key, on Vertex AI, or on an enterprise Code Assist license.
Sources
Every figure above was read from these pages on August 2026. Vendors reprice without notice; if you find a stale number, tell us.
- Gemini CLI installation documentation commands, specs, release channels
- @google/gemini-cli on npm published version, Node engine
- gemini-cli Homebrew formula formula version
- Transitioning Gemini CLI to Antigravity CLI