How to install and update Codex CLI on macOS, Windows and Linux
OpenAI's install and update commands for Codex CLI: script, npm and Homebrew. How to sign in, check the version, and set it up on Windows, WSL and Linux.


The short answer
Run OpenAI's install script, open a project, run codex, and choose Sign in with ChatGPT. To update, run the same command again, or codex update. npm and Homebrew work too; update with the tool you installed with.
| Method | Install | Update |
|---|---|---|
| macOS, Linux | curl -fsSL https://chatgpt.com/codex/install.sh | sh | The same command |
| Windows PowerShell | powershell -ExecutionPolicy ByPass -c "irm https://chatgpt.com/codex/install.ps1 | iex" | The same command |
| npm | npm install -g @openai/codex | The same command |
| Homebrew | brew install --cask codex | brew upgrade --cask codex |
The install scripts download from releases.openai.com and fall back to GitHub Releases. You can also download a build yourself from the latest release of openai/codex on GitHub, unpack it and rename it to codex.
Sign in and check the install
codex --version # prints the installed version
codex doctor # checks install, config, sign-in, Git and terminal
codex # start in your project and choose how to sign in- Sign in with ChatGPT uses your Plus, Pro, Business, Edu or Enterprise plan. An API key also works and is billed at API rates.
- On a server or over SSH, where no browser opens, run
codex login --device-auth. OpenAI labels it beta, and device code login has to be enabled in your ChatGPT security settings first.
Article · How to use Codex: your first task, permissions, and the commands you'll use → Installed? How to use Codex: your first task, permissions and common commands.
Article · Codex usage limits: when they reset, and what to do when you hit one → How much Codex your ChatGPT plan includes, and when it resets.
Codex on Windows and WSL
| Native Windows | WSL2 | |
|---|---|---|
| Where commands run | PowerShell | Your Linux distribution |
| Sandbox | The Windows sandbox | The Linux sandbox; install bubblewrap first |
| Install with | The PowerShell command above | The macOS, Linux command, inside WSL |
| Choose it when | Your project and tools are on Windows | You need Linux tools, or your repositories already live in WSL2 |
WSL1 stopped working with Codex 0.115. Inside WSL2, keep repositories under your Linux home folder; paths under /mnt/c are slower.
Article · Codex on Windows: the desktop app, the CLI, and WSL → Codex on Windows: the desktop app, the CLI, WSL and common errors.
Article · Codex on Linux: the desktop app, the CLI, and servers without a screen → Codex on Linux: the desktop app, the CLI and servers.
Do you want the CLI or the app?
- Codex CLI
- You work in the terminal, or script Codex
- Codex in the ChatGPT desktop app
- You want windows, diffs and buttons
- The Codex IDE extension
- You live in VS Code, Cursor or Windsurf
- Mira
- You want the CLI in a window, next to Claude Code
Article · The Codex app: where to get it now, and running Codex next to other agents → Where the Codex desktop app is now.
Let Mira install and update it
- Open Get started
ChatGPT account? It suggests Codex
- Press Install
Already installed Codex? Mira uses that copy
- Update from Settings › Agents
The installed version sits next to the latest one
Settings › Agents also has an Auto-update switch, off by default, that installs new versions once the agent is idle. Mira runs the Codex CLI itself and is not an OpenAI app.
Article · Run Claude Code, Codex, OpenCode and eight more coding agents in one app → The coding agents Mira runs in one app.
Questions
- Is Codex CLI free?
- The CLI is open source (Apache-2.0) and free to install. Using it takes a ChatGPT plan that includes Codex, or an API key.
- How do I know which version I have?
- Run
codex --version. codex updatedid nothing. Why?- It works when the installed release supports updating itself. Otherwise update the way you installed: the script, npm or Homebrew.
- Should I use npm or the script?
- OpenAI lists the script first. npm suits you if you already manage tools with Node.js. Stick to one, so you don't end up with two copies.
Article · Codex “stream disconnected before completion”: what it means and how to fix it → When Codex says “stream disconnected before completion”.
Article · Codex login: sign in with ChatGPT or an API key, sign in on a server, and fix login problems → Logging in to Codex with ChatGPT or an API key, including on a server.
Sources
Checked on November 24, 2026 against OpenAI's documentation (learn.chatgpt.com/docs: the Codex CLI page, developer-commands, auth, sandboxing, windows/windows-app, windows/wsl) and the README at github.com/openai/codex. Check those pages for the latest.
Keep reading

Fixing OpenAI and Codex 403 “unsupported_country_region_territory”
Why OpenAI and Codex return 403 unsupported_country_region_territory, how to fix false positives on VPNs or cloud IPs, and compliant alternatives.

Running Claude Code and Codex on Amazon Bedrock, Vertex AI, and Microsoft Foundry
Connect Claude Code and Codex to Amazon Bedrock, Vertex AI, and Microsoft Foundry: env vars, config.toml, auth, model pinning, and limits.

Using Claude Code with Chrome and Codex Browser: live debugging, Playwright, and previews
How to connect Claude Code to Chrome (extension, console logs, login limits) and use Codex Browser or Playwright, plus live dev-server previews in Mira.