Back to Tutorials
Beginner
15 minutes
Gemini Team

Getting Started with Gemini CLI

Learn the basics of installation, authentication, and your first AI-powered commands with Gemini CLI.

Tutorial Progress

0 of 5 completed
Prerequisites
  • Node.js 16+ installed on your system
  • Basic familiarity with command line
  • Google account for authentication
What You'll Learn
  • How to install Gemini CLI globally
  • Setting up authentication with Google
  • Running your first AI-powered commands
  • Understanding basic CLI options and flags

Step 1: Installation

First, let's install Gemini CLI globally using npm. This will make the gemini command available system-wide.

Install Gemini CLI
npm install -g @google/gemini-cli

Note: You might need to use sudo on macOS/Linux if you encounter permission errors.

Verify the installation by checking the version:

Verify Installation
gemini --version

Step 2: Authentication

Before using Gemini CLI, you need to authenticate with your Google account. This process will open your browser and guide you through the OAuth flow.

Authenticate with Google
gemini auth login

Success! After authentication, you'll see a confirmation message with your account details.

You can check your authentication status anytime:

Check Auth Status
gemini auth status

Step 3: Your First Command

Now let's run your first Gemini CLI command. We'll use the generate command to create some code.

Generate Code
gemini generate "Create a simple Hello World function in Python"

Expected Output:

Generated Python Code
def hello_world():
    """
    A simple function that prints Hello World
    """
    print("Hello, World!")

# Call the function
hello_world()

Step 4: Basic Usage Patterns

Let's explore some common usage patterns and commands you'll use frequently.

Interactive Chat Mode

Start an interactive conversation with Gemini:

Start Chat Session
gemini chat

Analyze Files

Analyze and get insights about your code files:

Analyze Code File
gemini analyze --file ./src/app.js

Get Help

View available commands and options:

Show Help
gemini --help

Step 5: Next Steps

Congratulations! You've successfully set up Gemini CLI and run your first commands. Here's what to explore next:

Advanced Commands
Learn about complex prompting and workflow automation
API Reference
Explore all available commands and options
On this page