Codex CLI

Pair with Codex in your terminal

Codex CLI

OpenAI Codex CLI is an coding agent that can read, modify, and run code on your local machine to help you build features faster, squash bugs, and understand unfamiliar code. It’s open source, and rapidly improving at the openai/codex repo in GitHub.

Install it with your preferred package manager:

npm install -g @openai/codex # Alternatively on macOS: `brew install codex`

Then run codex to get started:

codex

We recommended signing into your ChatGPT account to use Codex as part of your Plus, Pro, Team, Edu, or Enterprise plan. Learn more about what’s included in your ChatGPT plan. (You can also use Codex with an API key, but this requries additional setup.)

Working with the Codex CLI

Codex runs in an interactive terminal UI. You can ask Codex to do anything, and it will read your codebase, make edits and run commands. It’s easy to guide Codex as it works with prompts, including image inputs.

Approval modes

We’ve chosen a powerful default for Codex works on your computer: Auto. In this approval mode, Codex can read files, make edits, and run commands in the working directory automatically. However, Codex will need your approval to work outside the working directory or access network.

When you just want to chat, or if you want to plan before diving in, you can switch to Read Only mode with the /approvals command.

If you need Codex to read files, make edits, and run commands with network access, without approval, you can use Full Access. Excercise caution before doing so.

Models & reasoning

We recommend using Codex with GPT-5, our best coding model. The default reasoning level is medium, and you can upgrade to high for complex tasks with the /model command.

You can also use older models by using API-based auth and launching codex with the --model flag. (But why would you do that?)

Scripting Codex

You can also run Codex non-interactively with the exec command:

codex exec "fix the CI failure"

Detailed docs

For more detailed docs covering advanced configuration, MCP, and more, check out readmes and code at https://github.com/openai/codex.

FAQ

What platforms are supported?

The Codex CLI officially supports macOS and Linux. Windows support is still experimental—we recommend running in WSL.

How do I update Codex?

npm install -g @openai/codex@latest # If you installed with NPM
brew upgrade codex # If you installed with Homebrew