Getting Started Tutorial

Follow this comprehensive guide to install, configure, and start using Gemini CLI. You'll be up and running in just a few minutes.

1
Install
2
Authenticate
3
First Command
1

Install Gemini CLI

First, you'll need to install Gemini CLI globally on your system. Make sure you have Node.js 18+ installed before proceeding.

Using npm (recommended)

npm install -g @google/gemini-cli

Using yarn

yarn global add @google/gemini-cli

Verify installation

gemini --version

You should see the version number if installation was successful.

Prerequisites

Make sure you have Node.js 18 or higher installed. You can check your version with node --version

2

Authenticate with Google

Next, you'll need to authenticate with your Google account to access the Gemini API. This process is secure and only requires you to login once.

Start authentication

gemini auth login

This will open your browser and prompt you to sign in with Google.

Check authentication status

gemini auth status

Verify that you're successfully logged in.

Security Note

Your authentication tokens are stored securely on your local machine. Gemini CLI never stores your Google password.

3

Run Your First Command

Now you're ready to start using Gemini CLI! Let's run a few commands to get familiar with the basic functionality.

Simple text generation

gemini generate "Write a hello world program in Python"

Expected output: A Python hello world program with explanation

Code analysis

gemini analyze --file script.py

Analyze a Python file for potential improvements and issues.

Interactive mode

gemini chat

Start an interactive chat session with Gemini AI.

Get help

gemini --help

View all available commands and options.

๐ŸŽ‰ Congratulations! You're Ready to Go

You've successfully installed and set up Gemini CLI. Now explore more advanced features and discover how it can enhance your development workflow.

Common Issues & Solutions

โŒ Command not found: gemini

This usually means the global installation didn't work or your PATH isn't configured correctly.

Solution: Try reinstalling with npm install -g @google/gemini-cli or check your global npm path.

๐Ÿ” Authentication failed

Authentication issues can occur due to browser settings or network restrictions.

Solution: Try gemini auth logout then gemini auth login again.

๐Ÿšซ API quota exceeded

You've reached your API usage limit for the current period.

Solution: Wait for quota reset or upgrade your Google Cloud plan for higher limits.

โš ๏ธ Slow responses

Network latency or high API load can cause slower response times.

Solution: Try again later or use shorter prompts for faster processing.