Newbie’s Information to Gemini CLI: Set up, Setup, and Use It Like a Professional

Newbie’s Information to Gemini CLI: Set up, Setup, and Use It Like a ProfessionalNewbie’s Information to Gemini CLI: Set up, Setup, and Use It Like a Professional
Picture by Creator | Canva

 

Introduction

 
Gemini CLI is Google’s new open-source AI assistant that runs in your terminal. It brings the Gemini language mannequin (Gemini 2.5 Professional) on to your shell so you may ask questions, generate code, repair bugs, or create documentation with out leaving the command line. “Gemini” itself is an LLM and “Gemini CLI” is mainly a consumer device that makes mannequin interactive in your workflows. In brief, it’s like ChatGPT for builders. Google launched Gemini CLI in June 2025, and it’s FREE for people. You simply must login utilizing your private google account and it provides you entry to Gemini 2.5 Professional with an enormous 1 million-token context window for gratis (as much as 60 requests/minute and 1,000/day). It’s an important free and open supply various to AI coding assistants like Anthropic’s Claude Code.

Let me aid you with the setup and stroll you thru some examples to focus on its significance.

 

Setting Up Gemini CLI on Your System

 
To put in Gemini CLI, you want a command-line surroundings (Terminal on macOS/Linux, PowerShell or related on Home windows) and both Homebrew or Node.js. On macOS, the simplest technique is by way of Homebrew:

  1. Set up Gemini CLI by way of Homebrew: Execute the next command in your terminal
  2.  

  3. Alternatively, set up by way of Node (any OS): For those who want or don’t use Homebrew, set up Node.js (model 20 or increased. Then run:
  4. npm set up -g @google/gemini-cli

     

    or

    npx https://github.com/google-gemini/gemini-cli

     

    This installs the CLI globally on macOS, Linux, or Home windows. Node.js v20+ is required; you may obtain it from nodejs.org or use nvm to handle variations.

As soon as put in, you may merely run the next command to launch the gemini-cli:

 

This could begin the CLI (should you see the “Gemini CLI” ASCII banner, you’re set). If gemini just isn’t discovered, chances are you’ll must open a brand new terminal or add npm’s world bin to your PATH. You will notice one thing like this:

 

Screenshot of Gemini CLI LaunchScreenshot of Gemini CLI Launch
Screenshot of Gemini CLI Launch

 

On first run, Gemini CLI will immediate you to choose a coloration theme (gentle or darkish) after which log in along with your Google account. Comply with the directions within the browser (or CLI) to authorize. For those who want utilizing an API key as a substitute of login, you may set GEMINI_API_KEY=”YOUR_KEY” in your surroundings (see Google AI Studio to generate a key). As soon as authenticated, the CLI confirms it’s prepared to make use of.

 

Working Your First Gemini CLI Instructions

 
With Gemini CLI arrange, you can begin utilizing pure language instructions immediately. It opens a immediate (marked >) the place you sort questions or duties. For instance, let’s attempt with a easy immediate and ask: “Write a brief paragraph about why Gemini CLI is superior.” Right here’s output:

 

Screenshot of Gemini CLI: Simple Paragraph WritingScreenshot of Gemini CLI: Simple Paragraph Writing
Screenshot of Gemini CLI: Easy Paragraph Writing

 

// Job 1: Fixing bugs with Gemini CLI

Gemini CLI can combine with instruments like GitHub or your native Git to seek out points. For example, let’s use the built-in @search device to fetch a GitHub difficulty URL, then ask for a repair plan:

Immediate (Supply):

Right here’s a GitHub difficulty: [@search https://github.com/google-gemini/gemini-cli/issues/4715]. Analyze the code and counsel a 3-step repair plan.

 

The CLI recognized the foundation trigger and advised the best way to modify the code. The screenshot under exhibits it reporting a 3-step plan. You may overview its plan, then affirm to let Gemini CLI routinely apply the adjustments to your recordsdata.

 

Screenshot of Gemini CLI: Fixing bugsScreenshot of Gemini CLI: Fixing bugs
Screenshot of Gemini CLI: Fixing bugs

 

// Job 2a: Working with a Undertaking (Easy Instance)

I’ve created a venture folder by cloning the gitdiagram repo. If you wish to know extra about this repo, head over to my article: Make Sense of a 10K+ Line GitHub Repo With out Studying the Code. Let’s navigate to our venture folder utilizing:

 

Now run gemini. You can begin asking questions concerning the code. Let’s attempt the next immediate:

Immediate:
Clarify the primary parts of this codebase

 

Gemini CLI will scan the recordsdata and use the Gemini mannequin to summarize or reply, as proven within the screenshot under:

 

Screenshot of Gemini CLI: Working with a Project (Simple Example)Screenshot of Gemini CLI: Working with a Project (Simple Example)
Screenshot of Gemini CLI: Working with a Undertaking (Easy Instance)

 

It parsed the folders and returned a structured abstract (itemizing directories like src/, public/, and many others.). That is helpful for onboarding onto new tasks or producing documentation.

 

// Job 2b: Working with a Undertaking (Superior Instance)

Exploring the codebase is simple. Now let’s give it a extra technical process to see how the output seems. We’ll present the next immediate to Gemini:

Immediate:
Analyze this repo for frequent efficiency anti-patterns.

 

Screenshot of Gemini CLI: Working with a Project (Advanced Example)Screenshot of Gemini CLI: Working with a Project (Advanced Example)
Screenshot of Gemini CLI: Working with a Undertaking (Superior Instance)

 

The response was so detailed that I’ve solely included the beginning portion within the screenshot. Gemini CLI created an in depth plan after which learn each file independently. Ultimately, it shared a abstract of potential efficiency anti-patterns together with advisable subsequent steps:

Abstract of potential efficiency anti-patterns based mostly on preliminary evaluation:
   1. Massive Frontend Bundle Dimension:
       * Mermaid Library: The mermaid library is probably going a major contributor to the bundle measurement. If it isn't
         lazy-loaded, it can affect preliminary web page load efficiency.
       * `react-icons`: Relying on the way it's imported, it could actually additionally contribute to bundle measurement if not tree-shaken
         successfully.
   2. Unoptimized Picture Utilization: Whereas Subsequent.js has subsequent/picture, with out inspecting the precise picture utilization in parts,
      it is arduous to say if pictures are correctly optimized (e.g., right sizes, codecs, lazy loading).
   3. Potential Backend Efficiency Points (Python & Node.js):
       * N+1 Queries: This can be a frequent database anti-pattern that may considerably decelerate information retrieval.
       * Lack of Caching: If ceaselessly accessed information just isn't cached on the utility or database stage, it could actually lead
         to redundant computations and database hits.
       * Synchronous Operations: Blocking I/O in both backend may result in efficiency bottlenecks below heavy load.
   4. `reactStrictMode: false`: Whereas not a direct anti-pattern, it could actually disguise potential efficiency points associated to
      React's rendering conduct throughout improvement.
   5. Improvement-like Docker Quantity Mount: Mounting all the backend listing within the Docker container is much less
      optimum for manufacturing builds in comparison with copying solely crucial recordsdata.

  To substantiate these, additional investigation can be wanted, together with:

   * Bundle Evaluation: Utilizing instruments like @subsequent/bundle-analyzer to establish massive modules within the frontend.
   * Efficiency Profiling: Working the applying and utilizing browser developer instruments (for frontend) and backend
     profiling instruments to establish bottlenecks.
   * Code Overview: Deep diving into the src/ and backend/ code to establish particular cases of the anti-patterns
     talked about.

 

These examples present how Gemini CLI turns easy prompts into actual actions. You may question code, generate or refactor it, repair bugs, and enhance efficiency , all out of your terminal.

 

Wrapping Up

 
Gemini CLI is a strong new device for builders. After getting it put in on macOS (or any OS), you may work together with Google’s Gemini LLM as simply as any native command. A number of the key options that makes it totally different are:

  1. ReAct Agent Loop: Internally, it runs a ReAct agent loop along with your native surroundings. This implies it could actually determine when to name a device (search, run shell, edit file) versus when to reply straight. For instance, it fetched a URL with @search when wanted.
  2. Constructed-in Instruments: It has built-in “instruments” similar to grep, echo, file learn/write, and you’ll invoke internet search or file system queries from prompts.
  3. Multimodal Capabilities: Gemini CLI may even work with pictures/PDFs (since Gemini is multimodal). It helps integration with exterior Mannequin Context Protocol (MCP) servers e.g., you could possibly hook up a picture generator (Imagen) or a customized API. This allows you to do issues like “generate code from this sketch” or “summarize a PDF.”

Attempt it out: After following the setup above, open a terminal in a venture folder, sort gemini, and begin experimenting. You’ll shortly see how an AI companion in your shell can dramatically increase your productiveness!
 
 

Kanwal Mehreen is a machine studying engineer and a technical author with a profound ardour for information science and the intersection of AI with medication. She co-authored the e book “Maximizing Productiveness with ChatGPT”. As a Google Era Scholar 2022 for APAC, she champions range and tutorial excellence. She’s additionally acknowledged as a Teradata Range in Tech Scholar, Mitacs Globalink Analysis Scholar, and Harvard WeCode Scholar. Kanwal is an ardent advocate for change, having based FEMCodes to empower girls in STEM fields.