Skip to content

Codex CLI

Codex CLI is OpenAI’s terminal-native AI coding agent. It works with your files and shell, is sandboxed by default, and supports both interactive and headless modes. Codex is included with ChatGPT Plus, Pro, Business, Enterprise, and Edu plans.

Requires Node.js 22+. Works on macOS, Windows, and Linux.

Terminal window
npm install -g @openai/codex

Run codex and sign in with your ChatGPT account when prompted:

Terminal window
codex

Verify:

Terminal window
codex --version

Full walk-through: Getting Started with OpenAI → Install Codex. The Codex section also covers the Codex app and IDE extension options.

  • Interactive coding — refactor, debug, explore a codebase with Codex reading files, running commands, and iterating
  • Sandboxed execution — Codex runs in a sandbox by default, so it won’t touch files outside your project without approval
  • Headless automation — pass a prompt as an argument for CI/CD pipelines and scheduled jobs
  • Multiple surfaces — same Codex logic across the CLI, desktop app, and IDE extension