Home » Gemini AI Now Runs Directly In The Command Line

Gemini AI Now Runs Directly In The Command Line

AI integration is expanding into the Linux command line, exemplified by tools like Ollama, making its presence in this environment increasingly common.

The Gemini CLI tool enables users to access Google’s Gemini AI directly within their Linux terminal. This locally installed application supports various functions, including content generation, problem-solving, detailed research, and task management. Although initially designed for developers, Gemini CLI also serves end-users who require AI access without relying on web browsers or third-party graphical user interfaces.

Installation of Gemini CLI on Ubuntu-based distributions requires specific prerequisites. Users need a running instance of Ubuntu Linux or a compatible distribution, a user account with sudo privileges, and an active Google account. Prior to the initial execution of Gemini CLI, it is necessary to be signed into the Google account via the default web browser.

  1. The installation process for Gemini CLI involves several steps. First, users must open a terminal window.
  2. Next, Node.js is installed because Gemini CLI utilizes the Node.js package manager (npm).
  3. This is achieved by executing the command sudo apt-get install nodejs -y.
  4. Following Node.js, npm itself is installed using the command sudo apt-get install npm -y.
  5. Finally, Gemini CLI is installed with the command sudo npm install -g @google/gemini-cli.

This method is noted as the reliable way to ensure the gemini command is properly recognized, addressing issues where other installation instructions might result in the command not being found.


Gemini to replace Google Assistant on Android soon


Should an error occur during the initial attempt to run Gemini, necessitating an updated version of Node.js, a specific set of commands can be used.

  • First, curl -fsSL https://deb.nodesource.com/setup_23.x -o nodesource_setup.sh is executed to download the setup script.
  • This is followed by sudo -E bash nodesource_setup.sh to run the script. Node.js is then reinstalled with sudo apt-get install nodejs -y.
  • After these steps, npm must be reinstalled using sudo apt-get install npm -y.

Upon successful installation, the first-run configuration of Gemini involves a series of prompts. The user initiates the process by typing gemini in the terminal. Gemini then prompts the user to select a theme, which is navigated using arrow keys in the curses-based application. Subsequently, the user selects an authentication method. While alternative authentication options such as a Gemini API Key or Vertex AI exist, logging in with a Google account is presented as the most straightforward method. After selecting “Login with Google,” pressing Enter opens the default web browser. The user then selects the desired Google account for authentication. Once authenticated, the terminal window transitions to a Gemini prompt, allowing the user to input their first query.


Featured image credit

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *