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- Node.js 16+ installed on your system
- Basic familiarity with command line
- Google account for authentication
- 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.
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:
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.
gemini auth login
Success! After authentication, you'll see a confirmation message with your account details.
You can check your authentication status anytime:
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.
gemini generate "Create a simple Hello World function in Python"
Expected Output:
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:
gemini chat
Analyze Files
Analyze and get insights about your code files:
gemini analyze --file ./src/app.js
Get Help
View available commands and options:
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: