Quick install
| Platform | Command |
|---|---|
| macOS and Linux | curl -fsSL https://chatgpt.com/codex/install.sh | sh |
| Windows (PowerShell) | powershell -ExecutionPolicy ByPass -c "irm https://chatgpt.com/codex/install.ps1 | iex" |
| npm (any platform) | npm install -g @openai/codex |
| Homebrew | brew install --cask codex |
Then run codex in your project folder and choose Sign in with ChatGPT.
Commands are from OpenAI's Codex README and docs, checked in October 2026. Check OpenAI's Codex docs for the latest.
Step 1: Install Codex CLI
macOS and Linux
OpenAI's standalone installer is the recommended way to install Codex CLI on macOS and Linux:
curl -fsSL https://chatgpt.com/codex/install.sh | sh
Codex CLI supports macOS on Apple Silicon and Intel, and Linux on x86_64 and arm64.
Prefer a package manager? Use Homebrew:
brew install --cask codex
or npm:
npm install -g @openai/codex
You can also download a binary for your platform from the Codex GitHub releases page and rename it to codex.
Windows
Codex CLI runs natively on Windows. To install Codex CLI on Windows, run this in PowerShell:
powershell -ExecutionPolicy ByPass -c "irm https://chatgpt.com/codex/install.ps1 | iex"
On Windows, Codex uses a native Windows sandbox by default, so you don't need WSL or a virtual machine. OpenAI suggests WSL2 when you need Linux-native tooling or your workflow already runs there; in that case, install Codex inside WSL with the macOS and Linux command above.
Check the install
codex --version
If something looks wrong, codex doctor checks your installation, config, sign-in and runtime health.
Step 2: Sign in
Run codex in any folder. The first time, it asks you to choose a sign-in method:
- Sign in with ChatGPT uses your ChatGPT plan, so Codex usage comes with your subscription. It's the recommended option for Plus, Pro, Business, Edu and Enterprise plans.
- Sign in with an API key bills usage to your OpenAI API account.
You can also sign in from the command line:
codex login # browser sign-in
printenv OPENAI_API_KEY | codex login --with-api-key # API key from stdin
codex login --device-auth # device code, for remote or headless machines
codex login status # show the active sign-in
codex logout # clear stored credentials
On a server or a machine without a browser, OpenAI recommends device code sign-in. Codex stores credentials in ~/.codex/auth.json or your operating system's credential store.
Step 3: Run your first session
Open your project and start Codex:
cd my-project
codex
Type a task in plain language, such as "add input validation to the signup form and a test for it". A few slash commands are worth knowing on day one:
| Command | What it does |
|---|---|
/init | Creates an AGENTS.md file with instructions for Codex |
/model | Chooses the model and reasoning effort |
/permissions | Chooses what Codex can do without asking |
/status | Shows the current session configuration |
/review | Reviews your changes and finds issues |
AGENTS.md is where you tell Codex how your project works: how to run the tests, which conventions to follow, and what to avoid. Run /init once and edit the result.
Step 4: Set permissions and defaults
Codex asks before it edits files or runs commands outside the limits you set. You can change this per session with /permissions, or start Codex with flags:
codex --sandbox workspace-write --ask-for-approval on-request
The sandbox modes are read-only, workspace-write and danger-full-access. For lasting defaults, set the same options in ~/.codex/config.toml:
model = "gpt-6.1-sol"
approval_policy = "on-request"
sandbox_mode = "workspace-write"
Use codex --profile <name> to layer a named profile on top of your base config, for example one profile for careful work and another for quick experiments.
Step 5: Update Codex CLI
Codex updates often. The simplest way to update is:
codex update
Or update with the tool you installed it with:
curl -fsSL https://chatgpt.com/codex/install.sh | sh # standalone installer: rerun it
npm install -g @openai/codex@latest # npm
brew upgrade --cask codex # Homebrew
Run codex --version afterwards to confirm the new version.
Useful Codex CLI commands
| Command | What it does |
|---|---|
codex | Starts an interactive session |
codex exec "<task>" | Runs a task non-interactively, for scripts and CI |
codex review | Runs a code review non-interactively |
codex resume | Resumes a previous session (--last for the most recent) |
codex --worktree | Runs the session in a new git worktree |
codex mcp | Manages MCP servers |
codex app | Launches the Codex desktop app |
Run Codex alongside Claude Code in Chief
Once Codex CLI is installed and signed in, it's ready for Chief. Chief is an AI agent manager: you set a goal, Chief plans it as milestones and runs each one with the agent you choose.
- Codex and Claude Code in one plan. Set a default agent per project and pick Codex or Claude Code for any milestone. See Claude Code vs Codex for where each one shines.
- Runs the Codex you just installed. The Chief relay runs on macOS, Linux and Windows and starts the
codexon your machine, signed in to your own ChatGPT account. Your code stays where it is. - Independent work runs in parallel. Chief runs every milestone whose dependencies are done at the same time and checks each result against its definition of done.
- Talk to Chief from Codex. Add Chief's MCP server with
codex mcpand ask what's waiting on you without leaving your session.
Run Codex with Chief. Start free →
More on the pairing: Chief + Codex.
FAQ
How do I install Codex CLI?
On macOS and Linux, run curl -fsSL https://chatgpt.com/codex/install.sh | sh. On Windows, run the PowerShell installer. You can also use npm install -g @openai/codex or brew install --cask codex. Then run codex and sign in.
Does Codex CLI work on Windows?
Yes. Codex CLI runs natively on Windows with a Windows sandbox, so WSL isn't required. You can still use WSL2 if your tools are Linux-native.
How do I update Codex CLI?
Run codex update, or update with the tool you installed it with: rerun the install script, npm install -g @openai/codex@latest, or brew upgrade --cask codex.
Is Codex CLI free?
The Codex CLI is open source under the Apache-2.0 license. Using it needs a ChatGPT plan that includes Codex or an OpenAI API key billed per token. Check OpenAI's pricing page for current plans.
Do I need Node.js to install Codex CLI?
No. The standalone installers and Homebrew don't need Node.js. You only need Node.js if you choose to install with npm.
Can I use Codex CLI and Claude Code together?
Yes. Give each its own branch or git worktree so they don't edit the same files, or let Chief plan the work and send each milestone to the agent you choose.