🚀

Getting Started with Gemini CLI

Learn the basics of installing and configuring Gemini CLI for your first AI-powered commands.

beginner5 分钟阅读
#installation#setup#basics

# Getting Started with Gemini CLI

Welcome to the world of AI-powered command line tools! In this tutorial, you'll learn how to install and configure Gemini CLI to start leveraging Google's powerful AI capabilities directly from your terminal.

## Prerequisites

Before we begin, make sure you have:
- A computer running Windows, macOS, or Linux
- Basic familiarity with command line interfaces
- A Google account for API access

## Installation

### Step 1: Install Node.js

Gemini CLI requires Node.js version 16 or higher. Download and install it from [nodejs.org](https://nodejs.org/).

```bash
# Verify installation
node --version
npm --version
```

### Step 2: Install Gemini CLI

Install the CLI globally using npm:

```bash
npm install -g @google/gemini-cli
```

### Step 3: Verify Installation

Check if the installation was successful:

```bash
gemini --version
```

## Configuration

### Setting up API Access

1. Visit the [Google AI Studio](https://makersuite.google.com/app/apikey)
2. Create a new API key
3. Set your API key as an environment variable:

```bash
export GEMINI_API_KEY="YOUR_API_KEY"
```

### Basic Configuration

You can create a config file at `~/.gemini/config.json`:

```json
{
"model": "gemini-2.5-flash"
}
```

## Your First Session

Let's start the Gemini CLI and test it:

```bash
gemini
```

Then in the interactive session, try:
```
> Explain quantum computing in simple terms
```

Congratulations! You've successfully installed and configured Gemini CLI. You're now ready to explore more advanced features.

## Next Steps

- Learn about [Advanced Prompting Techniques](/tutorials/advanced-prompting)
- Explore [API Integration](/tutorials/api-integration)
- Set up [Automation & Scripting](/tutorials/automation)