OpenAI Codexcodex-cli 0.154 · macOS, Linux, WSL, Windows
1
Curious builder0 XP earned · 300 to level 2
0 daysFinish a lesson to begin
Badge collection0 of 6 unlocked
26 small wins to finish your pathNext lesson

Installation: what you get

One install, and a command with more subcommands than you will use in a year. This lesson is about the handful that matter.

bash
npm i -g @openai/codex
codex --version
Captured from a real run
codex-cli 0.154.0

That is the terminal version. Codex is also an IDE extension, a desktop app and a cloud service, and lesson 2 is about which is which. The CLI is the one that shows you what is happening, which makes it the right one to learn on.

The commands worth knowing on day one

bash
codex --help
Captured from a real run
Commands:
  exec              Run Codex non-interactively [aliases: e]
  review            Run a code review non-interactively
  login             Manage login
  mcp               Manage external MCP servers for Codex
  plugin            Manage Codex plugins
  doctor            Diagnose local Codex installation, config, auth, and runtime health
  sandbox           Run commands within a Codex-provided sandbox
  resume            Resume a previous interactive session
  apply             Apply the latest diff produced by Codex agent as a `git apply`

That is the real list, trimmed. Running codex with no subcommand starts the interactive session, which is where most work happens. The rest of this course is mostly about sandbox, exec, review, mcp and plugin.

Checking the install

doctor is the first thing to run when anything is odd, and it is worth running once now so the output is familiar later.

bash
codex doctor
Captured from a real run
Codex Doctor v0.154.0 · macos-aarch64

Environment
  ✓ system       en-IN
  ✓ disk         sufficient free disk space (116.6 GiB)
  ✓ security     no supported endpoint protection detected
  ✓ runtime      npm
      version                  0.154.0
  ✓ install      consistent

It checks the machine, the install, the config and the login. When a colleague says Codex is behaving strangely, this is the output to ask for.

Signing in

bash
codex login status
Captured from a real run
Logged in using ChatGPT

You can sign in with a ChatGPT account or with an API key. Which models you can then use depends on the plan behind that account, and lesson 0 showed what it looks like when the account cannot use them: the CLI is happy, the model call is refused.

You can follow along either way
Everything in the next three lessons works whether or not that sign-in gives you a model, because the sandbox does not call one.
Try it yourself
  • Run codex doctor and read every line once.
  • Run codex --help and pick out the five commands you think you will use.

Little by little, you're building something great.