In this categoryGemini ยท 24
- How to Install the Gemini CLI and Run Your First PromptStart
- How to Get a Gemini API Key from Google AI Studio
- How to Call the Gemini API from Python
- How to Give Gemini CLI Project Context with a GEMINI.md File
- How to Choose the Right Gemini Model for Coding Tasks
- How to Fix a Bug in Your Codebase with the Gemini CLI
- How to Set Up Gemini Code Assist in VS Code
- How to Stream Gemini Responses in Node.js
- How to Feed a Long Document into Gemini's Long Context
- How to Run the Gemini CLI Non-Interactively in Scripts
- How to Analyze a Video File with the Gemini API
- How to Connect an MCP Server to the Gemini CLI
- How to Fix Common Gemini CLI Authentication Errors
- How to Cache Long Context in the Gemini API to Cut Costs
- How to Summarize a YouTube Video with Gemini
- How to Analyze PDFs and Docs in the Gemini Chat App
- How to Extract Data from Images and Screenshots with Gemini
- How to Generate a Short Video with Veo in Gemini
- How to Ground Gemini Answers in Your Own Documents
- How to Use Gemini Inside Google Docs to Draft Faster
How to Install the Gemini CLI and Run Your First Prompt
Install Google's open-source Gemini CLI with npm, sign in, and run an interactive coding prompt from your terminal.
The Gemini CLI is Google's open-source command line agent. It runs Gemini models directly in your terminal so you can read code, edit files, run shell commands, and search the web without leaving the keyboard. This guide gets it installed, signed in, and answering your first prompt.
What you need
- Node.js 20 or newer installed (run node --version to check)
- A terminal: macOS Terminal, iTerm, Windows Terminal, or any Linux shell
- A Google account for the free sign-in tier, or a Gemini API key
- About 5 minutes
Step 1: Confirm Node is current
The CLI needs a recent Node. Check the version first so the install does not fail halfway through. If you are below 20, install a newer Node from nodejs.org or with a version manager like nvm.
Step 2: Run the CLI without installing
The fastest way to try it is npx, which downloads and runs the tool once. This is handy for a quick test before you commit to a global install.
npx https://github.com/google-gemini/gemini-cliStep 3: Install it globally
If you plan to use it often, install the package globally so the gemini command is always on your path. After this you can launch it from any folder.
npm install -g @google/gemini-cli
gemini --versionStep 4: Sign in and prompt
Launch the CLI by typing gemini in a project folder. On first run it asks how you want to authenticate. Choose Login with Google to use the free personal tier, which opens a browser window for consent. Once you are back, type a prompt and press Enter.
Result
You now have the Gemini CLI installed and authenticated. The gemini command opens an interactive session in whatever folder you run it in, and the agent can already read your files and answer questions about them.
Related guides
How to Get a Gemini API Key from Google AI Studio
Create a free Gemini API key in Google AI Studio and store it safely as an environment variable.
How to Give Gemini CLI Project Context with a GEMINI.md File
Create a GEMINI.md memory file so the Gemini CLI knows your project conventions on every run.
Watch related tutorials
09:00
12:00
16:12
3:58:44
12:00
14:00New guides in your inbox
Fresh step-by-step how-to guides as we publish them. One email a week, no more.