Gemini CLI: Complete Beginner’s Guide to Installation & Usage

Gemini CLI: Complete Beginner’s Guide to Installation & Usage

Gemini CLI is a free, open-source tool that brings Google’s Gemini AI directly into your Terminal, enabling developers and tech users to code, write, research, and manage files in plain English. It’s lightweight, supports long prompts, integrates with tools like VS Code, and is highly customizable.


:gear: Installation

  1. Install Node.js (v18 or higher) → Node.js Downloads
  2. Get Google Account or Gemini API KeyGoogle AI Studio
  3. Run instantly:
npx https://github.com/google-gemini/gemini-cli
  1. Install globally:
npm install -g @google/gemini-cli
  1. Verify installation:
gemini --version

:key: Authentication

  • On first run:
gemini

Choose a color theme and authenticate via Google Account or Gemini API key (API key offers higher quotas).


:light_bulb: Use Cases & Commands

1. Coding Assistant

  • Default model: gemini-2.5-pro (can switch to faster gemini-2.0-flash-lite):
gemini --m gemini-2.0-flash-lite
  • Example prompt: “Generate a function in Node.js that calculates the factorial of a number.”
  • Can save outputs directly to files, e.g.:
Save this code in a file named factorial.js

2. File & Project Management

  • Can create directories, files, and scaffold projects.
    Example prompt to scaffold a Go project:
I want to scaffold a new Go project with:
- Module name: github.com/user/project
- Language: Go
- Purpose: CLI app
...
  • Gemini CLI will request file system permissions before making changes.

:rocket: Key Benefits

  • Cross-functional: Coding, content creation, research, file handling, automation.
  • Speed: Switch between high-power and lightweight AI models.
  • Customizable: Themes, model selection, command chaining.

GitHub Repogoogle-gemini/gemini-cli


9 Likes