Categories
AI Code Generation Model Comparison Tutorials

How to Install Gemini CLI

Gemini CLI is becoming a go-to choice for many devs, especially those who prefer Google’s AI ecosystem. Lightweight, flexible, and deeply integrated with Google’s Gemini models, it’s a handy coding companion for experimenting with generative AI directly from your terminal. If you’re curious about setting it up, this guide will walk you through everything: from prerequisites to installation on macOS, Linux, and Windows. 

By the way, if you’re interested in the Claude Code CLI, here’s our guide for it.

What is Gemini CLI?

via GitHub

Gemini CLI is Google’s command-line interface for working with Gemini, the company’s flagship family of multimodal AI models. This includes well-tested models such as the Gemini 2.5 Pro, which you can try here as an alternative. With Gemini CLI, developers can:

  • Run text and code prompts against Gemini models.
  • Experiment with multimodal AI (text, code, images).
  • Integrate AI responses directly into workflows via shell scripts.
  • Prototype quickly without a heavy project setup.
  • Manage API credentials and configuration with simple commands.

In short, it’s a productivity booster that makes AI experimentation as simple as typing in your terminal.

Gemini CLI Requirements and Preparation

Before installing Gemini CLI, make sure your system meets the following requirements:

  • Operating System: Compatibility with Mac, Windows, and Linux systems.
  • Node.js: Version 18 or higher is required. This provides the runtime environment for the CLI.
  • Google Account: A Google account is necessary for authentication and access to the Gemini model.
  • Internet Connection: Required for installation, authentication, and interaction with the Gemini AI model.
  • Terminal/Command Prompt: The CLI operates directly through a command-line interface.

For best performance, use a modern terminal such as Bash, Zsh, or Fish on Unix-based systems, or PowerShell/Git Bash on Windows.

How to Install Gemini CLI

Gemini CLI supports two main installation options: npm-based (recommended) and native binaries.

Option 1: Install via npm (Recommended)

If you already have Node.js installed, the npm method is the simplest:

This installs Gemini CLI globally and makes it accessible from any directory. Avoid using sudo npm install -g to prevent permission issues.

Option 2: Install Native Binaries

If you don’t want Node.js as a dependency or need faster startup times, install the native binaries instead.

macOS/Linux/WSL:

curl -fsSL https://dl.google.com/gemini/install.sh | bash

Windows PowerShell:

irm https://dl.google.com/gemini/install.ps1 | iex

Here are the key points for installing Gemini CLI on Windows in PowerShell:

  • You need Node.js version 18 (preferably 20+) installed first. You can install it using winget:

powershell
winget install -e –id OpenJS.NodeJS

  • After Node.js is installed, run the npm global install command above in an elevated PowerShell or Windows Terminal (run as administrator).
  • To run Gemini CLI without a full install, you can also run:

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

  • Once installed, start the Gemini CLI by simply typing:

powershell
gemini

  • You will be prompted to choose a color theme and then authenticate via your Google account for access.

Both commands automatically download and install the latest stable release. You can also specify a version by appending arguments to the script (e.g., bash -s 1.2.0).

Post-Installation Setup

Once Gemini CLI is installed, configure it with your Google API key:

gemini config

Alternatively, you can set the API key as an environment variable in your shell profile:

export GOOGLE_API_KEY=”your-api-key-here”

Verify your installation by running:

gemini –version
gemini doctor

The first command confirms the installed version, while the second checks for any missing dependencies.

Starting Your First Gemini CLI Session

Navigate to a project folder and start Gemini CLI with:

gemini

From here, you can:

  • Ask Gemini to summarize your project.
  • Get code generation and explanations.
  • Use multimodal prompts (if your API tier supports them).
  • Automate repetitive tasks with shell integration.

For example:

gemini “Explain the purpose of this Python script”

Installing Gemini CLI on macOS

Here’s a focused walkthrough for macOS users.

System Prerequisites

  • macOS Catalina (10.15) or later.
  • Node.js 18+ if using the npm method.
  • Google API key from AI Studio.

Installation Steps

Via npm (Recommended):

npm install -g @google/gemini-cli

Via Native Homebrew:

brew install gemini-cli

Configuration

Set up authentication with your API key:

gemini config

Or update your .zshrc or .bashrc:

export GOOGLE_API_KEY=”your-api-key-here”

Finally, confirm everything works:

gemini –version
gemini doctor

macOS users enjoy a smooth setup experience thanks to the Unix underpinnings of the system, making Gemini CLI feel native and responsive.

Gemini CLI Features for Developers

Gemini CLI is more than just a command runner—it’s a versatile AI companion. Key features include:

  • Code Summarization & Explanation – Quickly understand codebases.
  • Debugging & Fix Suggestions – Spot and resolve issues interactively.
  • Project Guidance – Ask about entry points, file structures, or dependencies.
  • Multimodal Support – Use text, code, and images in your queries (where supported).
  • Git Integration – Run AI-assisted git commands (commit messages, branch names).
  • Refactoring & Testing – Generate tests or refactor code with conversational prompts.

With tab completion, command history, and slash commands (/help, /clear), Gemini CLI feels natural to use for daily development.

Try Gemini 2.5 Pro Prompts

1. Given this Python function that calculates the nth Fibonacci number using recursion, rewrite it using memoization and explain the time complexity improvement.
2. A train leaves City A at 60 km/h and another leaves City B (300 km away) at 40 km/h at the same time heading toward each other; calculate when and where they meet.
3. Create a RESTful API in Node.js using Express that allows users to register, log in, and retrieve their profile data securely with JWT authentication.
4. Given a CSV of daily stock prices, write a Python script using Pandas and Matplotlib to calculate and plot the 7-day moving average, then highlight the days with the highest trading volume.
5. Explain how a hash table works internally and describe a scenario where using a hash table would be a poor choice compared to a binary search tree.
6. Write a Python function that takes a paragraph of text, extracts all named entities using spaCy, and stores them in a normalized SQL database schema.

The Bottom Line

Gemini CLI is a fast, flexible, and AI-powered way to interact with Google’s Gemini models directly from your terminal. Whether you’re prototyping, debugging, or exploring multimodal AI, it keeps you productive without leaving your development environment.


That said, while Gemini CLI is excellent for rapid iteration, full IDEs or AI development environments—such as Bind AI IDE, which integrates Gemini alongside Claude, OpenAI, and DeepSeek—may still be better suited for complex projects that require deeper integrations. Try Bind AI IDE here.