How to install & set up Gemini CLI

By Google Cloud Tech

Share:

Gemini CLI: Installation, Exploration, and First Workflow

Key Concepts:

  • Gemini CLI: A command-line interface for interacting with Google’s Gemini models.
  • Gemini 3 Models: The latest generation of Gemini models, including Flash and Pro versions, offering varying levels of capability and cost.
  • Context: Providing Gemini CLI with relevant information (like files) to improve the quality of its responses.
  • Tool Calls: Gemini CLI’s ability to utilize external tools (like web search or file writing) to accomplish tasks.
  • Authentication: The process of verifying user identity to access Gemini CLI, using methods like Google login, API keys, or Vertex AI.
  • npm: Node Package Manager, used to install Gemini CLI.

1. Introduction & Conference Organizer Persona

This lesson focuses on getting started with Gemini CLI. The course adopts the scenario of a tech conference organizer, highlighting tasks like website development, research, social media management, and post-conference data analysis – all areas where Gemini CLI can provide significant assistance. The initial focus is on research, leveraging notes from previous organizers and supplementing them with current best practices.

2. Installation & Setup

Gemini CLI is installed as a global npm package. The installation command is npm install-google/gemini. Prerequisites and detailed installation instructions are available in the course’s reading materials. Once installed, the command gemini initiates the CLI. It can be used in any terminal, but the example demonstrates its use within Ghosty.

3. Authentication Methods

Upon launching, Gemini CLI requires authentication. Three methods are available:

  • Login with Google: Recommended for the course, providing access to the free tier.
  • API Key: For continued use beyond the free tier.
  • Vertex AI: Another option for increased request capacity.

The authentication process involves an OAuth flow in the user’s web browser. Successful authentication is confirmed within the CLI.

4. Gemini CLI Interface & Customization

The initial Gemini CLI interface displays tips and a Gemini banner. It utilizes the latest Gemini 3 models, defaulting to “auto” mode, which dynamically selects the most appropriate model (Gemini 3 Flash for simple tasks, Gemini 3 Pro for complex ones) based on the prompt’s complexity.

Customization options include:

  • /help: Displays a list of available commands and keyboard shortcuts.
  • /settings: Enables Vim mode for Vim users.
  • /settings hide footer: Removes the footer for a cleaner UI.
  • /the: Allows customization of the color scheme.

5. First Workflow: Research & Document Update

The first workflow involves reviewing suggestions from the previous year’s conference organizers (stored in suggestions.md). Gemini CLI can access this file using the @ symbol (e.g., @suggestions.md). The CLI then processes the file and provides a summary of the recommendations, including ensuring an easy-to-navigate website schedule and a unique social media hashtag.

To enhance the recommendations, Gemini CLI is prompted to incorporate current online best practices. This triggers a Google web search, and the results are integrated into the suggestions.md file. Before writing to the file, Gemini CLI presents a diff (a comparison of changes) and requires user confirmation. Options include expanding the diff, allowing the tool to run once, always allowing the tool, or opening the diff in an external editor like VS Code. The user can also reject the suggested changes.

6. Managing Conversation History & Stats

  • /clear: Clears the conversation history and tool calls, providing a fresh start for new tasks. This is recommended when switching between tasks.
  • /stats: Displays session statistics, including code changes, tool calls, requests, and the models used for each request. The “auto” model selection is demonstrated by showing requests distributed across different Gemini 3 models.
  • /docs: Opens the Gemini CLI documentation directly within the CLI.

7. Exiting Gemini CLI

The CLI can be exited using the /exit or quit command, providing a final snapshot of the session history.

8. Key Arguments & Perspectives

The lesson emphasizes the efficiency gains offered by Gemini CLI, particularly through its ability to access and process information from multiple sources (local files and the web) and automate tasks like document updates. The importance of context is highlighted, demonstrating how providing relevant files improves the quality of Gemini CLI’s responses. The tool call confirmation process underscores the user’s control over the actions taken by the CLI.

9. Notable Quotes

“Throughout this course, we’re going to take on the persona of an organizer for a tech conference.” – Sets the context for the practical application of Gemini CLI.

“The default is to use auto, which actually lets Gemini CLI intelligently decide which model is best for any given request.” – Explains the benefits of the auto model selection feature.

10. Synthesis & Conclusion

This lesson provides a foundational understanding of Gemini CLI, covering installation, authentication, interface customization, and a practical workflow example. It demonstrates the power of combining local context with web-based research to enhance decision-making and streamline tasks. The lesson prepares users for more advanced topics, such as context management and memory, which will be covered in subsequent lessons. The emphasis on user control and the availability of detailed documentation further empower users to effectively leverage Gemini CLI for their projects.

Chat with this Video

AI-Powered

Hi! I can answer questions about this video "How to install & set up Gemini CLI". What would you like to know?

Chat is based on the transcript of this video and may not be 100% accurate.

Related Videos

Ready to summarize another video?

Summarize YouTube Video