Two install paths, pick yours
If you are learning in this browser and do not want to install anything on your machine, skip this chapter. The rest of the path still works in the browser.
Installing the Codex CLI means getting the program onto your machine where the terminal can find it. There are two routes. Which one is easier depends on your computer.
On a Mac: Homebrew (easiest if you have it)
Homebrew is a Mac installer you run in the terminal — an app store
for commands. brew is the Homebrew command. If you already have it,
this one line installs Codex:
brew install --cask codex
↑ Homebrew ↑ cask = a desktop app, not a code library
If brew gives you a "command not found", you don't have Homebrew, and
you can either install it (one command, from brew.sh) or use the npm
route below instead. Don't agonize over it. The npm route works on
every machine.
Any machine: npm
The other route uses npm, a catalog of JavaScript programs. npm comes bundled with Node.js — the program that runs JavaScript outside a browser. Node is a separate program. Once Node is installed, this line installs Codex:
npm i -g @openai/codex
↑ npm ↑ -g = for the whole machine, so `codex` works in any folder
The Node question
Here's the one honest wrinkle compared to the Claude CLI. The Claude CLI had a one-line installer that needed nothing first. The npm route for Codex needs Node.js to already be on your machine.
So before the npm command works, you may have a one-time setup step: install Node. It's genuinely small, the next step covers it, and if you're on a Mac with Homebrew you can skip the whole thing. Just go in knowing the Codex install has one possible extra part. That's the "slightly heavier install" the last lesson warned you about. It's the biggest practical difference between the two tools, and it's still minor.