How to Install the Gemini CLI and Run Your First Prompt
Install Google's open-source Gemini CLI with npm, sign in, and run an interactive coding prompt from your terminal.
The Gemini CLI is Google's open-source command line agent. It runs Gemini models directly in your terminal so you can read code, edit files, run shell commands, and search the web without leaving the keyboard. This guide gets it installed, signed in, and answering your first prompt.
What you need
- Node.js 20 or newer installed (run node --version to check)
- A terminal: macOS Terminal, iTerm, Windows Terminal, or any Linux shell
- A Google account for the free sign-in tier, or a Gemini API key
- About 5 minutes
Step 1: Confirm Node is current
The CLI needs a recent Node. Check the version first so the install does not fail halfway through. If you are below 20, install a newer Node from nodejs.org or with a version manager like nvm.
Step 2: Run the CLI without installing
The fastest way to try it is npx, which downloads and runs the tool once. This is handy for a quick test before you commit to a global install.
npx https://github.com/google-gemini/gemini-cliStep 3: Install it globally
If you plan to use it often, install the package globally so the gemini command is always on your path. After this you can launch it from any folder.
npm install -g @google/gemini-cli
gemini --versionStep 4: Sign in and prompt
Launch the CLI by typing gemini in a project folder. On first run it asks how you want to authenticate. Choose Login with Google to use the free personal tier, which opens a browser window for consent. Once you are back, type a prompt and press Enter.
Result
You now have the Gemini CLI installed and authenticated. The gemini command opens an interactive session in whatever folder you run it in, and the agent can already read your files and answer questions about them.
Watch related tutorials
6:41
10:00
9:47
12:38
08:00
12:00