How to Install Claude Code, Gemini CLI, and Codex

Each of the three major AI labs now ships a terminal agent. Claude Code from Anthropic, Gemini CLI from Google, and Codex from OpenAI - all designed to run alongside your code, not just chat about it. This guide covers the setup for all three: the prerequisites, the access each requires, and the commands to go from a clean machine to a running agent.


Phase 1: The Foundation

Before any of the tools install cleanly, three things need to be in place.

Homebrew manages binaries on macOS. If it is not installed:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Node.js 20 or higher is required by Gemini CLI and Codex. Using nvm avoids permission conflicts that trip up global npm installs:

brew install nvm
nvm install 22

Git needs a global identity configured. All three agents create branches and commits - a missing name or email will cause errors mid-session:

git config --global user.name "Your Name"
git config --global user.email "you@example.com"

Phase 2: Access and API Keys

None of these tools run without credentials. Set up your accounts before running the install commands - authentication happens immediately after each installation.

  • Claude Code - Claude Pro or Max ($20+/mo), Web OAuth via claude login
  • Gemini CLI - Google Cloud project with billing enabled, Google Account OAuth
  • Codex CLI - OpenAI API credits, API key set as OPENAI_API_KEY

Phase 3: System Requirements

  • Shell - Zsh (default on macOS)
  • OS - macOS 13+ or Ubuntu 20.04+
  • RAM - 4GB minimum

Phase 4: Installation

Claude Code

npm install -g @anthropic-ai/claude-code

Then authenticate:

claude

This opens a browser prompt to link your Anthropic account. Once linked, add a CLAUDE.md file to your project root. Claude reads it at the start of every session to understand your project structure, build commands, and preferences.

Gemini CLI

brew install gemini-cli

Then authenticate:

gemini

The CLI starts an OAuth flow with your Google account. If you prefer an API key from Google AI Studio instead, add this to your ~/.zshrc:

export GEMINI_API_KEY="your-api-key"

Codex CLI

npm install -g @openai/codex

Then add your API key to your shell:

echo 'export OPENAI_API_KEY="your-key"' >> ~/.zshrc
source ~/.zshrc

Phase 5: Verification

Run this before starting any real work:

claude --version
gemini --version
codex --version
claude doctor

claude doctor runs a built-in diagnostic that checks authentication, permissions, and shell integration. If any step fails, it identifies exactly what to fix.


Phase 6: VS Code Integration

The CLI tools work inside VS Code’s integrated terminal without any extra configuration. Open it with Ctrl + \`` and all three agents are available immediately. You can runclaudein one tab to refactor a file whilegemini` analyzes a complex function in another.

To reduce typing, add aliases to your ~/.zshrc:

alias c='claude'
alias g='gemini'
alias cx='codex'

Both Claude and Gemini also read project-level instruction files. Claude uses CLAUDE.md, Gemini uses GEMINI.md. These files give the agent context about your architecture before the first prompt.


Moving these tools into the terminal is the shift from APL2 to APL3 - from an assistant that suggests edits to an agent that executes them. The setup takes an afternoon. What changes after is how you work.

Start building with Claude. Free course - no setup required.

Get the Free Starter Kit