Getting Started Tutorial
Follow this comprehensive guide to install, configure, and start using Gemini CLI. You'll be up and running in just a few minutes.
Install Gemini CLI
First, you'll need to install Gemini CLI globally on your system. Make sure you have Node.js 18+ installed before proceeding.
Using npm (recommended)
npm install -g @google/gemini-cliUsing yarn
yarn global add @google/gemini-cliVerify installation
gemini --versionYou should see the version number if installation was successful.
Prerequisites
Make sure you have Node.js 18 or higher installed. You can check your version with node --version
Authenticate with Google
Next, you'll need to authenticate with your Google account to access the Gemini API. This process is secure and only requires you to login once.
Start authentication
gemini auth loginThis will open your browser and prompt you to sign in with Google.
Check authentication status
gemini auth statusVerify that you're successfully logged in.
Security Note
Your authentication tokens are stored securely on your local machine. Gemini CLI never stores your Google password.
Run Your First Command
Now you're ready to start using Gemini CLI! Let's run a few commands to get familiar with the basic functionality.
Simple text generation
gemini generate "Write a hello world program in Python"Expected output: A Python hello world program with explanation
Code analysis
gemini analyze --file script.pyAnalyze a Python file for potential improvements and issues.
Interactive mode
gemini chatStart an interactive chat session with Gemini AI.
Get help
gemini --helpView all available commands and options.
๐ Congratulations! You're Ready to Go
You've successfully installed and set up Gemini CLI. Now explore more advanced features and discover how it can enhance your development workflow.
Common Issues & Solutions
โ Command not found: gemini
This usually means the global installation didn't work or your PATH isn't configured correctly.
npm install -g @google/gemini-cli or check your global npm path.๐ Authentication failed
Authentication issues can occur due to browser settings or network restrictions.
gemini auth logout then gemini auth login again.๐ซ API quota exceeded
You've reached your API usage limit for the current period.
โ ๏ธ Slow responses
Network latency or high API load can cause slower response times.