How to Install and Use Gemini CLI: A Simple Guide for Developers in 2025
If you’re a developer wanting to boost your work with AI, Google’s Gemini CLI is the tool you’ve been looking for. This strong command-line tool puts the features of Gemini 2.5 Pro right in your terminal—no extra tabs, no interruptions. In this guide, we’ll show you how to install and use Gemini CLI, step by step, so you can begin creating smarter and quicker today.
How to Install and Use Gemini CLI: A Simple Guide for Developers in 2025 |
🚀 What is Gemini CLI?
Gemini CLI is a free command-line tool created by Google that lets developers work with Gemini AI models directly from their terminal. Whether you are coding, fixing problems, creating documentation, or automating tasks, Gemini CLI serves as your AI helper—right in your command .
Key Features:
- Access to Gemini 2.5 Pro with a 1 million token context window
- Up to 1,000 requests per day and 60 requests per minute for free
- Works on Windows, macOS, and Linux
- Supports natural language prompts, code creation, file editing, and more
🛠 Requirements Before Installation
Before you set up Gemini CLI, ensure your system meets these needs:
1. Node.js v18 or newer
2. npm (Node Package Manager)
3. A Google account for signing in
To see if Node.js and npm are installed, run:
node -v
npm -v
If not installed, download the latest LTS version from .
📦 Step 1: Install Gemini CLI
There are two ways to install Gemini CLI:
✅ Global Installation (Recommended)
This method installs Gemini CLI for the entire system, allowing you to use it from any folder.
npm install -g @google/gemini-cli
⚡ Fast Start with NPX (No Installation)
If you just want to try it out:
npx @google/gemini-cli
🔐 Step 2: Authenticate with Google
Once installed, run:
gemini
You will be asked to sign in with your Google account. This will allow you to use the free version of Gemini 2.5 Pro.
> 💡 Tip: You can also use an API key from Google AI Studio for more advanced use or automation.
⚙️ Step 3: Set Up Your API Key (Optional)
If you would rather use an API key instead of signing in each time, make it an environment variable:
On macOS/Linux:
export GEMINI_API_KEY="your_api_key_here"
Add this line to your ~/.bashrc or ~/.zshrc file to keep it saved.
On Windows:
1. Look for “Environment Variables”
2. Click “New” under User Variables
3. Name: GEMINI_API_KEY
4. Value: your_api_key_here
🧪 Step 4: Check Your Installation
Run a simple command to make sure everything is working:
gemini "Explain how Kubernetes handles pod scheduling"
You should see a full answer right in your terminal. If you do—well done! 🎉 You’ve successfully set up and adjusted Gemini CLI.
💡 How to Use Gemini CLI: Practical Examples
Now that you're ready, here are some effective ways to use Gemini CLI:
1. Create Code:
gemini "Write a Python script that scrapes product prices from Amazon"
2. Explain Code:
cat app.js | gemini "Explain what this JavaScript code does"
3. Refactor Code:
cat legacy.py | gemini "Refactor this code to use async/await"
4. Generate Git Commit Messages:
git diff --cached | gemini -p "Generate a Conventional Commit message"
5. Run Interactive Chat Mode:
gemini --chat
This starts a terminal-based chatbot conversation with memory and context.
🧰 Bonus: Useful Built-in Tools
Gemini CLI has strong built-in tools:
read-file: Reads and summarizes content from files edit:
Suggests and makes changes to code
web-search: Supports answers with live Google Search
memory Tool: Keeps track of your preferences during the session
To view all tools, type:
/tools
🧠 Helpful Tips for Developers
Use GEMINI.md in your project folder to set coding guidelines and project rules.
Combine Gemini CLI with tools like VS Code, Git, and Docker for complete automation.
Use MCP (Model Control Points) to enhance Gemini’s features with custom plugins.
📈 Why Gemini CLI is Revolutionary in 2025With the growth of AI-driven development, Gemini CLI is notable for its:
Speed: No need to switch between the web browser and terminal.
Power: Easily manages large codebases.
Flexibility: Works on different platforms and languages.
Affordability: Has a generous free version with no need for a credit card.
Whether you're a solo developer, a startup leader, or a fan of automation, Gemini CLI can help you save hours of work every week.
🔚 Final Thoughts
Installing and using Gemini CLI is one of the smartest choices you can make as a developer in 2025. It’s quick, free, and highly effective. With just a few commands, you can turn your terminal into a complete AI helper.
> Ready to improve your workflow? Install Gemini CLI today and start creating with the future of AI.