Skip to main content

Getting Started & Setup

Installation and Environment Configuration

0:00
LearnStep 1/3

Installation and Environment Configuration

To get started with the Gemini CLI, you need to set up your development environment. This involves installing the package via npm and configuring your authentication credentials.

1. Prerequisites

Ensure you have Node.js (version 18 or higher) installed on your system. You can verify this by running node -v in your terminal.

2. Installation

Install the Gemini CLI globally using npm to access the command from anywhere in your terminal:

Note: If you encounter permission errors on Linux/macOS, you may need to use sudo or fix your npm permissions.

3. API Key Setup

The CLI requires a Google API key to interact with Gemini models. Obtain your key from Google AI Studio.

Set the environment variable GOOGLE_API_KEY so the CLI can authenticate automatically:

4. Verification

Verify the installation by checking the version:

5. Troubleshooting

  • Command not found: Ensure your npm global bin directory is in your system's PATH.
  • Authentication Error: Double-check that GOOGLE_API_KEY is set correctly in your current shell session.