Skip to content

Gemini CLI Setup

Gemini CLI is a terminal-based AI coding assistant from Google. It works similarly to other AI coding tools: you type natural language prompts in your terminal and Gemini reads, writes, and modifies files on your machine.

All the steps below happen inside a terminal. If you have never used a terminal before, follow the Using the Terminal guide first, then come back here.

Gemini CLI requires Node.js 18 or later. You may already have it installed. Open your terminal and run:

node --version

If you see a version number like v18.x.x or higher, skip ahead to Step 2. If you see “command not found” or a version below 18, follow the instructions below.

Install Node.js

macOS

Visit nodejs.org and download the LTS installer for macOS. Run the .pkg file and follow the prompts.

Alternatively, if you have Homebrew installed:

brew install node
Windows

Visit nodejs.org and download the LTS installer for Windows. Run the .msi file and follow the prompts. Make sure “Add to PATH” is ticked during installation.

After installing, verify by running:

node --version

You should see a version number like v20.x.x or higher.

Open your terminal and run:

npm install -g @google/gemini-cli

Note: Check the Gemini CLI documentation for the latest installation instructions, as the package name or method may change.

Alternatively, you can run it directly without installing:

npx https://github.com/google-gemini/gemini-cli

Run Gemini CLI for the first time:

gemini

This will prompt you to sign in with your Google account. Follow the on-screen instructions to complete authentication. You can use the free tier which provides access to Gemini models at no cost.

Navigate to your project folder and start Gemini CLI:

cd ~/my-project
gemini

You are now in an interactive session. Try your first prompt:

Step 1
List all the files in this directory and describe what each one does

Gemini will read your files and respond directly in the terminal.

CommandDescription
geminiStart an interactive session in the current directory
gemini "your prompt"Run a single prompt without entering interactive mode
gemini --helpShow all available options
Ctrl+CCancel the current response
Ctrl+DExit the interactive session

Return to the Prerequisites page and continue with the guides. When you see an LLM Prompt Box, copy the prompt and paste it into your Gemini CLI session.