Run npm uninstall -g @google/gemini-cli, or brew uninstall gemini-cli, or sudo port uninstall gemini-cli, depending on how you installed it. For npx, clear the _npx cache. Then remove the leftovers by hand: credentials and state in ~/.gemini/, per-project .gemini/ directories, the GEMINI_API_KEY export in your shell profile, and the Gemini CLI Companion editor extension. Do not delete all of ~/.gemini if you use Antigravity CLI: it stores its own config there.
- npm:
npm uninstall -g @google/gemini-cli. Homebrew:brew uninstall gemini-cli. - npx leaves nothing installed but caches the package in
_npx. - The package manager does not touch
~/.gemini/, which holds your credentials. - Do not
rm -rf ~/.geminiif you use Antigravity CLI. Its config lives in there. - Uninstalling does not revoke anything: delete the API key in AI Studio too.
- The editor extension is separate:
google.gemini-cli-vscode-ide-companion.
Work out how it was installed
The removal command depends on the install route, and machines that have had the CLI for a while often have two.
which -a gemini
npm ls -g @google/gemini-cli 2>/dev/null
brew list --versions gemini-cli 2>/dev/null
port installed gemini-cli 2>/dev/null
gemini --version
| What you see | Install route | Section |
|---|---|---|
A path under npm root -g or ~/.npm-global | npm global | npm |
/opt/homebrew/bin/gemini or /usr/local/bin/gemini | Homebrew | Homebrew |
/opt/local/bin/gemini | MacPorts | MacPorts |
Nothing, but you have been running npx | npx cache | npx |
| Two paths | Both. Remove each | All of the above |
Remove the package
npm uninstall -g @google/gemini-cli
brew uninstall gemini-cli
# optional: drop the dependency if nothing else needs it
brew autoremove
sudo port uninstall gemini-cli
npx
npx never installs anything permanently, so there is nothing to uninstall. It does cache the package. Clearing that cache removes Gemini CLI and every other package you have ever run with npx, which is usually fine and occasionally annoying.
npm config get cache # see where it is
rm -rf "$(npm config get cache)/_npx"
Remove-Item -Path (Join-Path $env:LocalAppData "npm-cache\_npx") -Recurse -Force
The directory the uninstaller does not touch
Every package manager removes the binary and nothing else. Your OAuth credentials, project state, trusted-folder list, and shell history all survive in ~/.gemini/.
ls -la ~/.gemini
What you will find, and who owns it. Contents vary by version; checked August 2026.
| Path | What it is | Safe to delete? |
|---|---|---|
settings.json | Your Gemini CLI user settings | Yes |
oauth_creds.json | Cached Google credentials | Yes, and you should |
google_accounts.json | Which account was signed in | Yes |
trustedFolders.json | Folders you told it to trust | Yes |
installation_id | Anonymous telemetry id | Yes |
projects.json, state.json | Per-project slugs and UI state | Yes |
tmp/, history/ | Per-project shell history and session state | Yes |
GEMINI.md | Your global instructions file | Only if you are not migrating |
antigravity-cli/ | Antigravity CLI state | No |
config/ | Antigravity CLI config and MCP servers | No |
antigravity/, antigravity-ide/ | Antigravity desktop app state | No |
Removing only the Gemini CLI parts
cd ~/.gemini
rm -f settings.json oauth_creds.json google_accounts.json \
trustedFolders.json installation_id projects.json state.json
rm -rf tmp history
# your global instructions file, if you do not want it any more
rm -f ~/.gemini/GEMINI.md
ls ~/.gemini | grep -i antigravity # must print nothing
rm -rf ~/.gemini
Per-project leftovers
Gemini CLI writes into repositories as well as your home directory, and those files are committed in a lot of teams. Removing the tool locally does not mean you want them gone from the repo, so decide deliberately.
| File | Purpose | Usually |
|---|---|---|
GEMINI.md | Project instructions for the agent | Keep. Antigravity CLI reads the same file |
.geminiignore | Paths the agent must not read | Keep, if anyone else uses the agent |
.gemini/settings.json | Project-level settings and MCP servers | Remove if nobody else runs the CLI |
.gemini/skills/ | Workspace skills | Rename to .agents/skills/ if you are migrating |
.gemini/sandbox.Dockerfile | Custom sandbox profile | Remove with the rest |
find ~/code -maxdepth 3 \( -name GEMINI.md -o -name .geminiignore -o -name .gemini \) -print
Shell profile, environment, and credentials
The installer appends to your shell profile and you probably appended a key to it yourself. Neither is removed by an uninstall.
grep -n "GEMINI\|gemini" ~/.zshrc ~/.zprofile ~/.bashrc ~/.bash_profile ~/.profile 2>/dev/null
Variables Gemini CLI reads.
| Variable | Remove if |
|---|---|
GEMINI_API_KEY | You are not keeping the key for anything else |
GEMINI_CLI_HOME | You relocated the config root |
GEMINI_CLI_TRUSTED_FOLDERS_PATH | You relocated the trust list |
GOOGLE_CLOUD_PROJECT, GOOGLE_CLOUD_LOCATION | They were set for Vertex AI and nothing else uses them |
The editor extension
The IDE integration is a separate VS Code extension and survives uninstalling the CLI.
code --list-extensions | grep -i gemini
code --uninstall-extension google.gemini-cli-vscode-ide-companion
If you use a VS Code-compatible editor with its own CLI, substitute that binary. In Zed or JetBrains the integration is an ACP agent registration rather than an extension, so remove it from the editor's agent list instead.
Verify it is gone
exec $SHELL -l
which -a gemini # expect nothing
gemini --version # expect command not found
ls -la ~/.gemini 2>/dev/null
echo "$GEMINI_API_KEY" # expect an empty line
Questions people ask
npm uninstall -g @google/gemini-cli for an npm install, brew uninstall gemini-cli for Homebrew, or sudo port uninstall gemini-cli for MacPorts. If you only ever ran it with npx, clear the _npx directory inside your npm cache.
No. Every package manager removes the binary only. Your settings, cached credentials, trusted folders, and per-project state stay in ~/.gemini/ until you delete them yourself.
Only if Antigravity is not installed. Antigravity CLI keeps its own configuration in ~/.gemini/antigravity-cli/ and ~/.gemini/config/, and the desktop app uses ~/.gemini/antigravity/. Run ls ~/.gemini first and delete the Gemini CLI files individually if any of those exist.
npm uninstall -g @google/gemini-cli in PowerShell, delete %UserProfile%\.gemini (minus anything Antigravity owns), and remove the GEMINI_API_KEY user variable with [Environment]::SetEnvironmentVariable("GEMINI_API_KEY",$null,"User").
Yes, if you want it revoked. Removing the CLI and unsetting the variable does not disable the key. Delete it in Google AI Studio, and remember it may also live in shell history, a CI secret, or a dotfiles repository.
Usually not. Antigravity CLI reads the same GEMINI.md and AGENTS.md files in the same locations, so if you are migrating rather than leaving, the file carries over unchanged.
You have a second install. npm and Homebrew place the binary in different directories, and PATH order decides which one you were running. which -a gemini lists every match; remove each one.
Sources
Every figure above was read from these pages on August 2026. Vendors reprice without notice; if you find a stale number, tell us.
- Uninstalling the CLI (Gemini CLI docs) package-manager commands
- Gemini CLI configuration reference config paths and environment variables
- Gemini CLI to Antigravity CLI migration where Antigravity stores its config