Podcast Title

Author Name

0:00
0:00
Album Art

How to Set Up and Use Google's Gemini CLI for Coding

By 10xdev team July 20, 2025

In a previous article, we saw how we can set up the Claude 4 models and also Claude Code. In this article, we're going to do the exact same thing but with Gemini from Google. We have the Gemini 2.5 Pro model and also now a command-line tool for Gemini. This is a very good combo as well. I definitely encourage you to test out both tools and also read the previous articles that we had in this publication where we covered Claude Code. They both have their advantages and disadvantages, and I definitely think that they can be used to complement each other.

Introducing the Gemini CLI

If you jump straight into the announcement from Google, we can see that this is a very new tool, released just a few weeks ago at the time of this writing. This is your open-source AI agent. Free and open-source, the Gemini CLI brings Gemini directly into the developer's terminal with unmatched access for individuals.

One of the good things about having a command-line interface tool is that you can run it in any IDE. Whether you're using PyCharm, VS Code, or any other editor, you can even use a simple notepad with the terminal on the side. It can run everywhere you have a terminal available.

Key Features

Let's quickly skim through its capabilities before looking at the GitHub repository for setup.

  • Free of Charge for Individuals: A very important point is that the Gemini CLI is free of charge. Simply log in with a personal Google account to try it out. While there are still limits, you can test it out very extensively before hitting them. You can always switch to usage-based billing on an API basis if needed.
  • Powerful Models: You have the capabilities of multi-turn chat and problem-solving (MCPS). Although MCPS is from Anthropic and their models are specifically trained on coding tasks, it is still supported with Gemini CLI tools.
  • Customization and Automation: You can customize prompts and instructions, automate tasks, and integrate with existing workflows. It is very similar to Claude Code in this regard.
  • Google Search Integration: You can ground prompts with Google Search to fetch web pages and provide real-time external context to the models.
  • Multi-modal Capabilities: You can use other models from Google for tasks like image and video generation. This is a significant capability, but its utility depends on your daily work. Are you primarily focused on coding, or do you need a general-purpose tool?
  • Open and Extensible: The tool is open-source under the Apache 2.0 license, which means it's going to get better and better with more support. It also shares technology with the Gemini Code Assistant, so it will be integrated into various editors and extensions like Cursor and VS Code.

A Look at the GitHub Repository

The GitHub repo for this tool has amassed almost 55,000 stars in just a week or two since its release. This indicates it will be supported very extensively. With numerous pull requests and issues, it's only going to improve, likely at a faster pace than comparable tools because it's open-source.

A very important aspect when working with these agents is using markdown files to explain project plans and code structure. If you have a specific structure for writing code, endpoints, or commands, get it into markdown files. Feed that into the context, and the models will provide way better results. It doesn't matter if you're using Gemini, Claude, or ChatGPT; the most important thing is the context you provide.

Here are some of its capabilities highlighted in the repository: * Query and edit large codebases, even beyond Gemini's 1 million token context window. * Generate new UIs from PDFs or sketches, thanks to its vision capabilities. * Use tools and MCPS servers. * Ground your queries with Google Search.

Installation and Setup

The prerequisite is to have NodeJS installed, exactly like with Claude Code. Then, you can run the following command:

npx @google/gemini-cli

Let's try to install it.

npm i -g @google/gemini-cli

After the installation, which is also what you need to do for Claude Code, you can run the tool.

gemini

You can select a theme; let's go with the default. Now, you can either use a Vertex AI Google API key or log in with a Google account for free testing. It will direct you to a sign-in page. Once authorized, you're ready to go.

Getting Started

If you hit /, you'll see it's the exact same setup as Claude. The available commands include:

  • about: Show version information
  • clear: Clear conversation history
  • compress: Compress conversation history
  • edit: Edit the last user prompt
  • help: Show help
  • mcp: Start an MCP server
  • stats: Show conversation stats
  • theme: Change the theme
  • docs: Manage documentation

Let's try to generate some documentation.

generate documentation for my codebase. and explain all to me. I'm new to this codebase.

This is a very easy way to get into new codebases and understand what's going on much sooner. If you're working in larger projects with a specific coding style, get that style and all relevant documentation into a markdown file, feed it into the context, and you'll get way better results.

The tool will start generating the documentation. It will begin by creating a README.md file in the root directory. Let's proceed.

At the bottom of the terminal, you can see the Gemini 2.5 Pro model being used. This is a very good coding model, and your preference might vary. I also really like the Claude Opus model. You can see how much context is left before it resets or summarizes.

To apply the changes, you can hit Control+S. In Claude, it's Control+R R, so it's very easy to use these tools together. Let's allow it to create the README.md file.

Comparing the Output

Now that the file is created, let's examine it. The new readme.md file contains around 100 lines of content. It includes a codebase overview, a table of contents, key functionality, basic documentation about the core scripts, usage examples, and setup instructions.

If you compare it with a file generated by Claude (claude.md), the structure is pretty much the exact same. They both provide an overview, developer instructions, installation dependencies, and common tasks. They are very similar tools.

Final Thoughts

Make sure to go in and check both of them out to see if you prefer Gemini or Claude. Just make sure you're using one of these tools in your daily work. You can also set up your Gemini API key for unlimited access on an API basis.

Here is an example of how to run it for a specific task:

cd into a new project
gemini write me a Gemini Discord bot that answers question using FAQ.MD file I will provide

You can also make it create a plan and then implement each step in phases. It's very important to check out the CLI commands, the troubleshooting guide, and the full documentation. If you're already familiar with Claude Code or the Gemini CLI, you can switch back and forth between them with very little effort. Go and check it out; it's very important to use this in your daily work if you're in the coding world.

Join the 10xdev Community

Subscribe and get 8+ free PDFs that contain detailed roadmaps with recommended learning periods for each programming language or field, along with links to free resources such as books, YouTube tutorials, and courses with certificates.

Recommended For You

Up Next