All tutorials/3 min/Beginner

Gemini CLI tutorial

How to Install and Run Gemini CLI on Mac and Windows

Install Gemini CLI, open the right folder, and run gemini from your terminal in three simple steps.

Gemini CLITerminalMac + Windows
quick-start

Quick command sequence

$ npm install -g @google/gemini-cli && cd /path/to/your/project && gemini

/en/tutorials/how-to-install-and-run-gemini-cli-mac-windows

Interactive command lab

1/3

Step 1

Install Gemini CLI

This installs the gemini command globally with npm.

Checkpoint

If npm is missing, install Node.js first.

zsh — tutorial-lab

Command tray

$ npm install -g @google/gemini-cli

added packages

gemini command available

Steps

  1. 1

    Step

    Install Gemini CLI

    This installs the gemini command globally with npm.

    npm install -g @google/gemini-cli
  2. 2

    Step

    Go to your project folder

    Gemini reads context from the folder where you start it.

    cd /path/to/your/project
  3. 3

    Step

    Start Gemini

    Sign in if prompted, then ask Gemini to explain, edit, or generate files in this folder.

    gemini

Why this matters

Starting Gemini CLI from the right folder matters because AI coding tools use the current directory as their working context. This keeps the conversation focused on the project you actually want to improve.

Troubleshooting

  • If npm is not recognized, install Node.js first from nodejs.org.
  • If gemini is not recognized after install, restart Terminal or PowerShell.
  • If login fails, run gemini again and complete the browser sign-in flow.

FAQ

What is Gemini CLI?

Gemini CLI is a terminal tool for using Google Gemini from your command line.

Does Gemini CLI work on Windows?

Yes. Use PowerShell or Windows Terminal after installing Node.js.

Why do I need to cd into a folder first?

The folder gives Gemini the project context it should inspect or help with.

Do I need Node.js?

Yes. The npm install command requires Node.js and npm.

Can Gemini CLI edit files?

Depending on mode and permissions, Gemini CLI can help generate or edit files. Review changes before keeping them.

Related tutorials