No history yet

Installation and Setup

Installing the CLI

The Gemini Command-Line Interface (CLI) lets you interact with Gemini directly from your terminal. It's a powerful way to integrate Gemini into your scripts and development workflows. Before you can install it, you'll need to have Node.js and its package manager, npm, installed on your system.

Once you have npm ready, open your terminal and run the following command to install the Gemini CLI globally on your machine. This makes the gemini command available from any directory.

npm install -g @google/gemini-cli

Connecting Your Account

With the CLI installed, you need to connect it to your Google account. This authentication step grants the CLI permission to access Gemini's features on your behalf. It's a one-time setup.

Run this command in your terminal:

gemini auth login

This command will automatically open a new window or tab in your web browser, prompting you to log in to your Google account. Follow the on-screen instructions to sign in and approve the necessary permissions. The page will look similar to other Google account authorization screens you've seen before.

Lesson image

Verifying Your Setup

After you've successfully logged in through your browser, you can verify that the CLI is installed and authenticated correctly. A simple way to do this is by asking the CLI for a list of available commands.

Run the help command:

gemini help

If everything is set up properly, your terminal will display a list of all the commands you can use with the Gemini CLI, such as gemini chat and gemini list. This confirms your installation is ready to go.

Let's check your understanding of these initial setup commands.

Quiz Questions 1/4

What is the primary prerequisite you need to have installed on your system before you can install the Gemini CLI?

Quiz Questions 2/4

Which command should you run in your terminal to install the Gemini CLI so it's available from any directory?

You're now ready to start using the Gemini CLI.