How to install and use Gemini CLI: Google login and first task
Install Gemini CLI from the official docs, sign in with Google, and complete a first coding task in your repo.
To use Gemini in the terminal to read a repo and change code, finish three jobs: install Gemini CLI, sign in with a Google account, then complete a first coding task in the current project.
Follow the official get-started path instead of guessing commands. The queries are how to install Gemini CLI, Gemini CLI Google login, and the command gemini. Docs live at geminicli.com/docs/get-started/.
Match the runtime, then pick an install path
Global npm install
Confirm node -v is 20.0.0 or newer, then run npm install -g @google/gemini-cli. That is the official default. The stable channel is the latest tag.
Homebrew or a one-off
On macOS or Linux you can brew install gemini-cli. To try once, use npx @google/gemini-cli. Do not install both npm and Homebrew copies; the PATH will fight.
| Method | Who it fits | Watch for |
|---|---|---|
| Sign in with Google | Local machine with a browser | Personal accounts usually skip a project; Workspace often needs GOOGLE_CLOUD_PROJECT |
| Gemini API key | AI Studio users, no browser | Treat the key as a secret; do not commit it |
| Vertex AI | Existing Google Cloud project | A Cloud project and region are required |
Install, sign in, first coding task
- 01Check Node and install
Official docs require Node.js 20.0.0+ and list macOS 15+, Windows 11 24H2+, Ubuntu 20.04+. After install, run
geminiand wait for the auth prompt. - 02Sign in with Google
Choose 1. Sign in with Google, pick the account, click Sign in. Credentials cache locally. If a work account asks for a project, set the env var before the next session.
- 03Do one verifiable job in the repo
Start
geminiat the project root. Ask for a read-only explanation of the entry file first. Then use an official-style prompt: write unit tests for an existing module, or propose one small change. - 04Read the diff before writes
The CLI asks before editing files or running side-effect commands. Choose Allow once; do not grant permanent access by default. Check quota with
/stats model.
node -v
npm install -g @google/gemini-cli
gemini
# After login, at the repo root, for example:
# Read the entry file and explain how the app starts.
# Then write unit tests for Login.js and wait before writing files.- Does a personal Google account need a Cloud project?
- Official docs say most personal accounts do not. Company, school, or Workspace accounts usually do. Personal accounts can still be asked for a project when an official exception applies.
- The login page never opens. What now?
- OAuth redirects the browser to localhost that the CLI listens on. Remote SSH, a headless host, or a network that blocks localhost will fail. Use a Gemini API key, or sign in on a machine that can open a browser.
- How large should the first coding task be?
- Pick something you can test or diff immediately. Official examples write tests for Login.js, or clone chalk and explain the source. Do not start with a whole-repo rewrite.
- Does install replace a design review?
- No. This is a terminal assistant. When the meeting is the same module diagram, open sitdraw.
Understand first, then approve the write
A model can narrate a change that sounds right. Without your write approval it should not touch the repo. You still run the tests.