...

/

Installation, Authentication, and the Command Palette

Installation, Authentication, and the Command Palette

Learn how to install, authenticate, and use the core commands of the Gemini CLI to prepare the development environment.

With our project plan and stack defined, the next step is preparing the development environment. We’ll use the Gemini command line interface (CLI) as our main tool. In this lesson, we’ll cover installation, authentication, and a quick overview of the core commands that will guide our workflow. Once the environment is ready, we can start building.

Prerequisites: System requirements

Before installing, check that your development environment meets the requirements. The Gemini CLI runs on Node.js and works across platforms, so setup is simple.

The necessary components are:

  • Operating system: The Gemini CLI is compatible with all major operating systems. We can be using macOS, Linux, or Windows.

  • Node.js: We will need Node.js version 20 or higher installed on our system. The CLI is distributed via npm (Node Package Manager), which is included with every Node.js installation.

Note: We can verify our current Node.js version by opening a terminal and running the command node -v. If the reported version is below v20.0.0 or if the command is not found, we will need to install or update Node.js before proceeding to the next step.

Installing the Gemini CLI

With our prerequisites in order, we can install the Gemini CLI globally on our system. This is accomplished with a single command using npm, making the gemini command available from any directory in our terminal.

npm install -g @google/gemini-cli

This command instructs npm to fetch the @google/gemini-cli package and install it globally (-g). The process may take a moment to complete.

Note: Running without installation
For those who prefer not to install packages globally or wish to quickly run the latest version, there is an alternative using npx (Node Package Runner). The following command will download and run the Gemini CLI for a single session without saving it to your system: npx https://github.com/google-gemini/gemini-cli. While this is useful for one-off tasks, for our course, we will rely on the global installation to ensure the gemini command is always available.

To confirm that the installation was successful, we will run the main gemini command.

gemini

Let’s try executing the above ...