Gemini CLI, how to install it in short: you need Node.js 20 or later, then you run one npm command and type gemini. Gemini CLI is Google's open source AI agent for the terminal. It reads your project, edits files, runs commands and answers questions about code, using Gemini models. (Gemini CLI docs: Installation (opens in a new tab); Gemini CLI docs: Get started (opens in a new tab))

Before you install it, check one thing. On June 18, 2026, Google stopped serving Gemini CLI to people on the free tier, Google One, Google AI Pro and Google AI Ultra. Those users now get Antigravity CLI, a newer closed source tool. Gemini CLI keeps working for organizations on a Gemini Code Assist Standard or Enterprise license, for Google Cloud users and for people with a paid Gemini API key. (Gemini CLI docs: Installation (opens in a new tab); Gemini CLI on GitHub: Transitioning Gemini CLI to Antigravity CLI (opens in a new tab); The New Stack (opens in a new tab))

So this guide is for you if your company pays for Gemini Code Assist, you work in Google Cloud, or you are happy to pay per use with an API key. If you only have a personal Google account, read the section on Antigravity CLI at the end first.

What you need before you install Gemini CLI

The official docs list macOS 15 or later, Windows 11 24H2 or later, or Ubuntu 20.04 or later. You need Node.js 20.0.0 or newer, a Bash, Zsh or PowerShell shell, and an internet connection. Google suggests 4GB of RAM for short sessions and 16GB or more for long sessions on large codebases. You also have to be in a location where Gemini Code Assist is offered. (Gemini CLI docs: Installation (opens in a new tab))

Tip: Type node -v in your terminal first. If it prints a number below 20, or nothing at all, install a current Node.js before you go on.

How to install Gemini CLI, step by step

1. Install it with npm

Open a terminal and run the command below. It installs the latest stable release globally, so the gemini command works from any folder.

Install command

npm install -g @google/gemini-cli

The docs also list Homebrew, MacPorts and Anaconda as install options, and Gemini CLI comes preinstalled in Google Cloud Shell and Cloud Workstations. If you only want to try it once, npx @google/gemini-cli runs it without a permanent install. (Gemini CLI docs: Installation (opens in a new tab))

There are three release channels: stable, preview and nightly. Google recommends stable for most people. Stable is published weekly and is built from the previous week's preview plus bug fixes. To update later, run gemini update. (Gemini CLI docs: Installation (opens in a new tab); Gemini CLI docs: Cheatsheet (opens in a new tab))

2. Start it

Move into the folder of the project you want help with, then type gemini. The first run asks how you want to authenticate for this project.

3. Pick how to sign in

Choose the option that matches how you pay. The three routes are below.

Sign in with Google is the option for organization accounts such as a company, school or Google Workspace. Select it, pick your account in the browser and click Sign in. The docs say organization users, Gemini Code Assist license holders and Developer Program license holders also need a Google Cloud project: enable the Gemini for Cloud API and set GOOGLE_CLOUD_PROJECT to your project ID. (Gemini CLI docs: Authentication (opens in a new tab); Gemini CLI docs: Get started (opens in a new tab))

Use Gemini API key is the route with no Cloud project. Get a key from Google AI Studio, set it as an environment variable, then run gemini and pick Use Gemini API key. Google's transition notice says paid Gemini API keys keep working with Gemini CLI. (Gemini CLI docs: Authentication (opens in a new tab); Gemini CLI on GitHub: Transitioning Gemini CLI to Antigravity CLI (opens in a new tab))

Set your API key (macOS or Linux)

export GEMINI_API_KEY="YOUR_GEMINI_API_KEY"

Vertex AI is the route for Google Cloud teams. Set GOOGLE_CLOUD_PROJECT and GOOGLE_CLOUD_LOCATION, sign in with gcloud auth application-default login, or use a service account key or a Google Cloud API key, then pick Vertex AI when gemini starts. (Gemini CLI docs: Authentication (opens in a new tab))

Tip: Treat the API key like a password. To avoid typing the export line every time, add it to your .bashrc or .zshrc, or put it in a .gemini/.env file. Gemini CLI loads the first .env file it finds, starting from the current folder.

Your first tasks in Gemini CLI

Google's quickstart suggests plain English requests like these. When Gemini CLI wants to change a file or run a command, it asks first. Choose Allow once until you know how it behaves. (Gemini CLI docs: Get started (opens in a new tab))

Prompt 1: Explain a project

Clone the 'chalk' repository from https://github.com/chalk/chalk, read its key source files, and explain how it works.

Prompt 2: Clean up files

Rename the photos in my "photos" directory based on their contents.

Prompt 3: Merge spreadsheets

Combine the two .csv files into a single .csv file, with each year a different column.

Prompt 4: Write tests

Write unit tests for Login.js.

Commands worth learning on day one

Type @ followed by a path to hand Gemini a specific file or folder. Philipp Schmid's cheatsheet notes that it respects .gitignore and .geminiignore. Start a line with ! to run a shell command, or type ! on its own to switch into shell mode. (Philipp Schmid: Gemini CLI cheatsheet (opens in a new tab))

Run /init to create a starting GEMINI.md file. That file holds your project's rules, such as which test command to use or which folders to leave alone. A global file at ~/.gemini/GEMINI.md applies to every project, and /memory show prints the combined context the model actually receives. (Gemini CLI docs: Cheatsheet (opens in a new tab); Philipp Schmid: Gemini CLI cheatsheet (opens in a new tab))

Use /stats model to see your token use and remaining quota, /chat save with a tag to keep a conversation, and /quit to leave. Outside a session, gemini -p followed by a prompt in quotes answers once and exits, and gemini -r latest picks up your most recent session. (Gemini CLI docs: Get started (opens in a new tab); Gemini CLI docs: Cheatsheet (opens in a new tab); Philipp Schmid: Gemini CLI cheatsheet (opens in a new tab))

Tip: Write your coding rules once in GEMINI.md instead of repeating them in every prompt. Short, specific rules work better than a long essay.

Where Gemini CLI falls short

Google's own docs say Gemini CLI has not been optimized for Gemini 4 Argon and point users of that model to Antigravity. In a test on the June shutdown day, The New Stack hit repeated HTTP 503 high demand errors with Gemini CLI, and automatic retries ate into the free quota until the tester turned on billing. In that test, non-interactive mode could not write files or run shell commands. (Gemini CLI docs: Installation (opens in a new tab); The New Stack: Gemini CLI vs. Antigravity (opens in a new tab))

The approval mode setting decides how much it does without asking. The choices are default, auto_edit, yolo and plan. Yolo approves every action automatically, so keep it for throwaway folders. (Gemini CLI docs: Cheatsheet (opens in a new tab))

If you are a free or AI Pro user: Antigravity CLI

Google moved personal accounts to Antigravity CLI, a closed source Go program started with the agy command. Google says Agent Skills, Hooks, Subagents and Extensions carry over, and the official migration guide with an FAQ is at antigravity.google/docs/gcli-migration. The New Stack found that its Gemini extensions imported and ran as skills, while a simple single file custom command did not. (Gemini CLI on GitHub: Transitioning Gemini CLI to Antigravity CLI (opens in a new tab); The New Stack (opens in a new tab); The New Stack: Gemini CLI vs. Antigravity (opens in a new tab))

The short version: Gemini CLI is still a solid, open source agent if you reach it through work, Google Cloud or a paid API key. For a personal account, install Antigravity CLI instead, and keep Gemini CLI for the projects where your company pays.