# Installing Gemini CLI and signing in

Course: Gemini CLI from Zero — https://zero2vibecode.com/learn/gemini-cli
Canonical URL: https://zero2vibecode.com/learn/gemini-cli/0-1-install-gemini-cli
Verified against: Gemini CLI v0.65.0 (2026-10-22)
Last updated: 2026-10-22

Gemini CLI installs with npm or Homebrew as a program called gemini, and signs in with a Google account, a Gemini API key or Vertex AI. First check which tool your account is meant to use: for unpaid and Google One accounts, Google has replaced it with Antigravity CLI.

Gemini CLI is Google's open-source coding agent for the terminal. Before you install anything, there is one question to settle, because Google settled it in the project's own README.

## First: is Gemini CLI the tool for your account?

The note at the top of the [Gemini CLI README](https://github.com/google-gemini/gemini-cli) says that for **unpaid-tier and Google One users, Gemini CLI was replaced by Antigravity CLI on June 18, 2026**. The same README says Gemini CLI is not optimized for the latest Gemini models, and points to Antigravity CLI for the best coding experience with them.

Google's [announcement](https://developers.googleblog.com/an-important-update-transitioning-gemini-cli-to-antigravity-cli) adds who keeps Gemini CLI: it stays available with paid Gemini API keys, and organizations using it through a Gemini Code Assist Standard or Enterprise license keep their access unchanged.

So:

- **You sign in with a free personal Google account, or through a Google One / Google AI Pro or Ultra subscription:** your tool is [Antigravity CLI](https://antigravity.google/product/antigravity-cli). Its command is `agy`, and Google's migration guide says it reads the same GEMINI.md and AGENTS.md files this course teaches.
- **You use a paid Gemini or Gemini Enterprise Agent Platform API key, or an organization's Gemini Code Assist Standard or Enterprise license:** Gemini CLI is still yours, and every command in this course is its command.

**If you are on Antigravity CLI.** 
Stay with the course. Starting in the right folder, writing a project context file, reading a change before you approve it and committing before a task are the same habits in both tools. The commands, flags and settings in these lessons are Gemini CLI's; look up the Antigravity CLI equivalents in its own documentation rather than assuming they match.

## What the install actually does

It puts one program, `gemini`, into a folder your shell searches — your PATH. It runs on Node.js, so you need Node installed first; the installation guide lists the minimum version and the recommended system specs.

## Install it

From the official [installation guide](https://geminicli.com/docs/get-started/installation/):

```bash
npm install -g @google/gemini-cli
```

On macOS or Linux with Homebrew:

```bash
brew install gemini-cli
```

Or run it once without installing anything:

```bash
npx @google/gemini-cli
```

The `-g` in the npm command installs it as a program for your user, not as a library inside one project.

Then check it from a **new** terminal window:

```bash
gemini --version
```

## Release channels

Gemini CLI ships three:

- **Stable**, published weekly, uses the `latest` tag. The install command above, with no tag, gets you this one. Use it.
- **Preview**, also weekly, with the `preview` tag. Not fully vetted; may contain regressions.
- **Nightly**, every day, with the `nightly` tag. Everything on the main branch, with validations still pending.

`gemini update` updates to the latest version.

Install it the npm way in the terminal below. The simulator does not run the agent, but the install command is the real one.

## The first run: signing in

Start it with `gemini`. The model runs on Google's side, so it asks how you will authenticate. The [authentication guide](https://geminicli.com/docs/get-started/authentication/) lists three ways:

**Sign in with Google.** Choose it, and Gemini CLI opens a sign-in page in your browser. Your credentials are then cached locally for future sessions. Google AI Pro and Ultra subscriptions (the README's "Google One users") were moved to Antigravity CLI on June 18, 2026 — see the section above.

**Use a Gemini API key.** Google's announcement says Gemini CLI "will remain accessible via paid Gemini and Gemini Enterprise Agent Platform API keys", so the key has to be a paid one; a free-of-charge key is the unpaid tier the README sends to Antigravity CLI. Create the key in Google AI Studio, put it in an environment variable, start `gemini`, and choose **Use Gemini API key**:

```bash
export GEMINI_API_KEY="YOUR_GEMINI_API_KEY"
gemini
```

**Vertex AI.** For Google Cloud users. You set `GOOGLE_CLOUD_PROJECT` and `GOOGLE_CLOUD_LOCATION` and authenticate with Google Cloud credentials.

Company, school and Google Workspace accounts also need a Google Cloud project set before signing in with Google; the authentication guide walks through it.

**Keys are passwords.** 
An API key is a credential with usage attached to it. Keep it in an environment variable or a .env file that Git ignores, never in a source file or a commit.

**Is Gemini CLI free?**

It depends on your account, and the answer changed in 2026. The Gemini CLI README says unpaid-tier and Google One users were moved to Antigravity CLI on June 18, 2026, while Google's announcement says Gemini CLI stays available with paid Gemini API keys and for organizations on Code Assist Standard or Enterprise licenses. The lessons on this site are free and run in a browser simulator either way.

**Does Gemini CLI work on Windows?**

Yes. Its installation guide lists Windows alongside macOS and Linux, with Bash, Zsh or PowerShell as the shell, and gives PowerShell versions of the environment-variable commands.
