Gemini CLI Installation Guide for macOS
blog.postMeta
Installing Gemini CLI on macOS
Getting Google's Gemini CLI up and running on your macOS machine is a straightforward process. You can choose between Homebrew, for a simple and managed installation, or npm (Node Package Manager) if you already have a Node.js environment set up.
Option 1: Using Homebrew (Recommended)
Homebrew is the recommended way to install and manage command-line tools on macOS.
-
Install Homebrew: If you don't have Homebrew installed, open your Terminal and paste the following command:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
-
Install Gemini CLI: Once Homebrew is ready, you can install Gemini CLI with a single command:
brew install gemini-cli
-
Verify Installation: To confirm that Gemini CLI was installed correctly, run:
gemini --version
Option 2: Using npm
If you're a developer with Node.js and npm already installed, you might prefer this method.
-
Install Node.js: If you don't have Node.js, we recommend installing it via the official package or a version manager like
nvm
. You need version 18 or higher. -
Install Gemini CLI Globally: Install the package globally using npm:
npm install -g @google-gemini/cli
-
Verify Installation: Check the installation by running:
gemini --version
First-Time Setup
After installation, the first time you run a gemini
command, you will be prompted to log in with your Google account. This is required to get your free license to use the Gemini API.
gemini prompt "Hello, world!"
Follow the on-screen instructions to authorize the tool. Once completed, you're ready to start using Gemini CLI!