Gemini CLI is Google's open-source AI agent for the terminal. You describe a change in plain English and it reads your project and helps you make it. This recipe takes you from install to a first small edit.
Read this first: who can use it
Google's own pages say Gemini CLI has been replaced for some users. The GitHub README states that free individual access and Google AI Pro/Ultra (Google One) access moved to Antigravity CLI (agy) on 18 June 2026. It says Gemini CLI is designed for Gemini Code Assist Standard or Enterprise licences, and it still documents signing in with a Gemini API key from Google AI Studio.
Google's Developers Blog confirms this. Gemini CLI also stays available to anyone using a paid Gemini API key, and the Gemini CLI repository remains open source under Apache 2.0. If you're moving to the new tool, start with our Antigravity CLI getting started guide and the Antigravity CLI tool page.
What that means for you:
- If you have a work Code Assist licence or a Gemini API key, this recipe applies.
- If you only have a free personal Google account or a Google AI Pro/Ultra plan, check the Gemini CLI repository for the latest instructions and Google's Antigravity CLI. Plans and limits change, so we don't quote them here.
Before you start
- A computer with a terminal, and Node.js 20 or later (the installation page lists Node.js 20.0.0+).
- A way to sign in (see Step 3).
- A practice folder you don't mind changing.
Step 1: Install it
Any one of these works, per the README:
# npm npm install -g @google/gemini-cli # Homebrew (macOS or Linux) brew install gemini-cli # or try it without installing npx @google/gemini-cli
Step 2: Make a practice project
mkdir gemini-practice cd gemini-practice echo "<h1>Hello</h1>" > index.html
Always start Gemini CLI from the folder you want it to work in.
Step 3: Start it and sign in
gemini
Follow the sign-in prompts. For the API key route, set your key first (get one from Google AI Studio):
export GEMINI_API_KEY="YOUR_API_KEY" gemini
If you use a Code Assist licence through an organisation, the README says to set GOOGLE_CLOUD_PROJECT to your project ID before signing in with Google. Inside the app, /auth lets you change your sign-in method later.
Keep your API key private. Never paste it into a chat, commit it to Git or share a screenshot of it.
Step 4: Ask a question first
Start with something that only reads:
What files are in this project and what does index.html do?
You can point at a file with @, for example @index.html, to include its contents.
Step 5: Make your first change
Turn index.html into a simple page with a title, a short paragraph about my favourite hobby and some basic styling. Keep it in one file.
Read what Gemini CLI proposes, and any permission request, before approving it. Then open index.html in your browser and ask for tweaks:
Make the heading blue and centre everything.
If a change goes wrong, Google's docs describe a /restore command that returns files to how they were before a tool ran, but only if checkpointing is set up. Don't rely on it. Use Git for a proper safety net (see our git safety net guide).
Step 6: Handy commands
Anything starting with / is a command. From Google's command reference:
| Command | What it does |
|---|---|
/help | Shows help and available commands |
/init | Generates a GEMINI.md file for the current directory |
/memory | Shows, lists or refreshes the context files in use |
/mcp | Manages MCP servers |
/tools | Lists available tools |
/quit | Exits |
You can also run a shell command by starting a line with !. The docs say commands run this way have the same impact as in your normal terminal, so be careful.
Step 7: Give it standing instructions
GEMINI.md is a plain Markdown file of project instructions. Gemini CLI loads it and sends it to the model with every prompt. A short example:
# My project - Use British English in visible text. - Keep CSS in one file. - Ask before adding new dependencies.
Run /memory show to see what is loaded. The filename can be changed with the context.fileName setting, which is one way to share an AGENTS.md file across tools.
Safety habits
- Commit before big changes so you can undo.
- Read before approving anything that deletes files or installs software.
- Trust folders deliberately. Gemini CLI has an optional Trusted Folders feature. In an untrusted folder, the docs say you are always prompted before any tool runs.
- Keep secrets out of prompts and files.
Troubleshooting
"command not found: gemini". Open a new terminal window. If it persists, reinstall and check that Node.js is version 20 or later with node --version.
Sign-in doesn't work. Re-read the notice near the top of this page. Your account type may no longer be supported by Gemini CLI.
Where to go next
- Compare approaches in Install Claude Code and make your first change.
- Learn what an MCP server is and manage them with
/mcp.