Short answer
Install it with npm (it needs Node.js 20 or newer), type gemini in a project folder, sign in with a personal Google account, and describe what you want in plain language. The agent reads your files, proposes edits and commands, and asks before running them, with a free allowance of 60 requests a minute and 1,000 a day during the preview.
Follow-up question How does it compare with Claude Code and Codex CLI?
Gemini CLI is Google's open-source AI agent for the terminal, released in preview on June 25, 2025. A CLI (command-line interface) is a program you use by typing in a terminal window instead of clicking. An agent here means the model does not just answer: it can read files in your folder, write changes, and run commands, step by step, toward the goal you describe.
What makes it easy to try is the price of entry. With a personal Google account you get Gemini 2.5 Pro, a model that can take in about a million tokens of context (a token is a piece of a word), at no charge within the preview limits: up to 1,000 model requests a day, and 60 in any one minute.
Install and sign in
You need Node.js version 20 or newer, the JavaScript runtime many developer tools are built on. Check with node --version. Then, in a terminal:
npm install -g @google/gemini-cli
gemini
If you would rather not install anything permanently, npx https://github.com/google-gemini/gemini-cli runs it once. On first launch you choose a color theme and then sign in through your browser with a Google account.
The alternative is an API key from Google AI Studio, which gives you control over the model and paid rate limits. Keep the key out of your files: set it in your shell with export GEMINI_API_KEY="your-key" for the session, and never paste it into code you share.
A first task, step by step
Start in a small, low-stakes folder, ideally one tracked by Git so every change can be undone. Here is a worked example with an illustrative folder of three CSV files from a club's bake sale.
- Open the folder and start the agent:
cd bake-salethengemini. - Ask it to look before it touches anything:
@sales/ Describe what these three CSV files contain and whether their columns match. Do not change any files yet.The @ symbol adds the contents of a file or folder to your prompt. By default it skips files your Git setup ignores, such as .env files that often hold secrets.
- Give the actual task, with a clear finish line:
Write a Python script, totals.py, that combines the three files and prints total sales per item, sorted from highest to lowest. Then run it and show me the output.- Read each proposal. When the agent wants to create a file or run a command, Gemini CLI shows it and waits for your confirmation. Approve only what you understand.
- Check the result yourself. Open the script, compare one total with a quick sum in a spreadsheet, and only then commit the change.
A few commands help along the way: /help lists everything, /stats shows token use for the session, /compress replaces a long conversation with a summary to save tokens, and ! runs a shell command such as !git diff without leaving the agent. Type /quit to exit.
Try it: Create a GEMINI.md file in your test folder with two rules, for example "Use Python 3 standard library only" and "Explain every command before running it." Start gemini, type /memory show to confirm it loaded, and repeat the bake-sale task to see the rules applied.
Instructions, memory and safety settings
GEMINI.md is a plain text file of standing instructions. Gemini CLI loads these files from your home folder (~/.gemini/) and from the project and its subfolders, combining them, so you can keep personal preferences and project rules separate. /memory add appends a line, and /memory refresh reloads the files after you edit them.
For one-off jobs in scripts, gemini -p "your prompt" runs a single prompt without the interactive screen. Two flags deserve care. --sandbox (or -s) runs tools inside a restricted environment, which limits what a mistaken command can reach. --yolo approves every tool call automatically; keep it for throwaway folders or containers. If you start with --checkpointing, /restore can roll files back to how they were before a tool changed them.
How does it compare with Claude Code and Codex CLI?
All three are agents that work in your terminal, read your project, edit files and run commands with your approval. The differences are mostly in models, cost and setup. The Codex CLI details below are from its documentation as of early July 2025, when OpenAI moved it to a new version written in Rust.
| Gemini CLI | Codex CLI | |
|---|---|---|
| Maker and models | Google; Gemini 2.5 Pro | OpenAI; o4-mini by default, other models selectable |
| Open source | Yes, Apache 2.0 | Yes, Apache-2.0 |
| Install | npm install -g @google/gemini-cli | brew install codex or a release binary |
| Sign-in | Google account (free preview quota) or Gemini API key | OpenAI API key, or codex login for ChatGPT Plus and Pro users |
| Project instructions | GEMINI.md | AGENTS.md |
| Default caution | Asks before edits and commands | Asks before commands outside a small trusted set; read-only sandbox |
| Hands-off mode | --yolo | --full-auto, which keeps writes in the current folder and blocks network access |
Claude Code, Anthropic's terminal agent, follows the same pattern: it reads standing instructions from a CLAUDE.md file and asks permission before actions that modify your system. Our explainer on coding agents covers how it works in more detail.
In practice, the choice often comes down to which model family you already use and pay for. Gemini CLI's free preview quota makes it the easiest of the three to try without a bill. Whichever you pick, the same habits apply: start in a Git-tracked folder, give a clear task with a way to check it, read each proposed command, and keep fully automatic modes for sandboxes.
Sources
- Gemini CLI README and CLI docs (commit 8adc586, July 5, 2025) — Google on GitHub, July 5, 2025
- Gemini CLI: your open-source AI agent — Google (The Keyword), June 25, 2025
- OpenAI Codex CLI README (commit abcca30, July 1, 2025) — OpenAI on GitHub, July 1, 2025