Quick Start

Let's help you get started with Gemini CLI quickly, from installation to running your first command.

What is Gemini CLI?

Gemini CLI is an open-source command-line interface that brings Google's Gemini large language model directly into your terminal. Instead of switching to a browser or a separate application, you can ask questions, analyse code, summarise files, and automate repetitive tasks without ever leaving the shell you already work in.

Under the hood, Gemini CLI connects to the Google AI API, sends your prompt along with any files or context you supply, and streams the response back to your terminal. It supports stdin piping, which means you can feed in the output of any other command — git diffs, log files, database exports — and ask Gemini to reason about them. This composability is what makes Gemini CLI a natural fit for automation scripts and CI/CD pipelines.

Unlike many AI coding tools that are tightly coupled to a specific editor, Gemini CLI is editor-agnostic. Whether you use Vim, Emacs, VS Code, or JetBrains IDEs, your workflow remains unchanged. Gemini CLI integrates at the shell level, so it works everywhere a terminal works.

The project is fully open source, hosted on GitHub, and welcomes contributions from the community. The roadmap is public, issues are tracked openly, and every release goes through a transparent review process.

1M+
Context window tokens
Free tier
Available via Google AI Studio
Open source
MIT-licensed on GitHub

Get Up and Running in 3 Steps

1

Install Gemini CLI

Gemini CLI is distributed as an npm package and requires Node.js 18 or later. If you are on macOS and prefer Homebrew, a formula is also available. Choose the method that fits your environment:

# Install using npm (all platforms)

npm install -g @google/gemini-cli

# Or using Homebrew (macOS)

brew install gemini-cli

After installation, the gemini binary will be available globally. You can verify the installation by running gemini --version.

2

Configure Your API Key

To connect Gemini CLI to Google's AI service, you need a free API key from Google AI Studio. Visit aistudio.google.com, sign in with your Google account, and create a new API key. Once you have it, configure Gemini CLI in one of two ways:

# Option A: environment variable (recommended for scripts)

export GEMINI_API_KEY="your-api-key-here"

# Option B: persist via config command

gemini config set api-key YOUR_API_KEY

The config command writes the key to ~/.config/gemini/config.json so it persists across terminal sessions. For shared or CI environments, prefer the environment variable to avoid accidentally committing credentials to version control.

3

Run Your First Command

With the CLI installed and your API key configured, you are ready to interact with Gemini. Start with the built-in verification commands, then try a real prompt:

# Check version

gemini --version

# Get help

gemini --help

# Simple conversation

gemini "Hello, Gemini!"

# Analyse a file

gemini "Explain what this script does" < my-script.sh

If you see a response from Gemini, everything is working. The last example demonstrates piping — a pattern you will use constantly once Gemini CLI becomes part of your daily workflow.

What You Can Do with Gemini CLI

Once you are set up, Gemini CLI opens up a wide range of possibilities. Here is a quick overview of the most popular capabilities:

Code Generation

Describe what you need in plain English and receive production-ready code snippets, boilerplate, or full module scaffolds instantly.

Code Review

Pipe a Git diff or a source file and ask Gemini to identify bugs, suggest improvements, and flag security issues before you open a pull request.

Documentation

Generate README files, inline comments, API reference docs, and changelogs directly from your source code — keeping documentation in sync with your codebase.

File Analysis

Summarise log files, parse configuration files, interpret CSV exports, and extract structured information from unstructured text — all without writing custom scripts.

Test Generation

Automatically generate unit tests, integration test scaffolds, and test data fixtures for your existing code, dramatically reducing the time to achieve meaningful coverage.

Shell Automation

Embed Gemini CLI calls inside Bash or Python scripts to create intelligent pipelines that make decisions, transform data, and generate reports without human intervention.

Recommended Learning Path

If you are new to Gemini CLI, the following path will take you from complete beginner to confident power user in a structured way:

A

Master the basics

Learn the core flags (--model, --temperature, --max-tokens) and practise piping file content into prompts. Spend time here before moving on.

B

Explore use cases

Browse the official use-case pages for code review, documentation, testing, and collaboration to discover patterns that apply to your own work.

C

Integrate MCP servers

Connect external tools via the Model Context Protocol to extend Gemini CLI with live data sources, custom functions, and third-party APIs.

D

Build automation scripts

Combine Gemini CLI with shell scripting to create reusable workflows — nightly documentation updates, automated PR descriptions, or intelligent log monitoring alerts.

Frequently Asked Questions

What is Gemini CLI?

Gemini CLI is an open-source command-line interface that brings Google's Gemini large language model directly into your terminal. It lets you ask questions, analyse files, generate code, and automate repetitive development tasks without leaving the command line.

Do I need a paid Google Cloud account to use Gemini CLI?

No. You can get started with a free API key from Google AI Studio (aistudio.google.com). The free tier provides a generous quota suitable for personal projects and experimentation. Paid tiers are available for higher-volume use cases.

Which operating systems does Gemini CLI support?

Gemini CLI runs on macOS, Linux, and Windows (via WSL or a native Node.js installation). It requires Node.js 18 or later. Installation via npm works on all three platforms, and a Homebrew formula is available for macOS users.

Next Steps

Congratulations — you have successfully installed and configured Gemini CLI. Here is what to explore next: