← Blog

How-to4 min read

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.

Mirasim's Get started, where Codex can be installed with one clickMirasim's Get started, where Codex can be installed with one click

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.

MethodInstallUpdate
macOS, Linuxcurl -fsSL https://chatgpt.com/codex/install.sh | shThe same command
Windows PowerShellpowershell -ExecutionPolicy ByPass -c "irm https://chatgpt.com/codex/install.ps1 | iex"The same command
npmnpm install -g @openai/codexThe same command
Homebrewbrew install --cask codexbrew 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

bash
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.

Codex on Windows and WSL

Native WindowsWSL2
Where commands runPowerShellYour Linux distribution
SandboxThe Windows sandboxThe Linux sandbox; install bubblewrap first
Install withThe PowerShell command aboveThe macOS, Linux command, inside WSL
Choose it whenYour project and tools are on WindowsYou 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.

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
Mirasim
You want the CLI in a window, next to Claude Code

Let Mirasim install and update it

  1. Open Get started

    ChatGPT account? It suggests Codex

  2. Press Install

    Already installed Codex? Mirasim uses that copy

  3. 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. Mirasim runs the Codex CLI itself and is not an OpenAI 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 update did 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.

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