Install and Update Codex CLI: Mac, Linux, Windows
Installing the OpenAI Codex CLI is one command per platform – curl -fsSL https://chatgpt.com/codex/install.sh | sh on macOS and Linux, powershell -ExecutionPolicy ByPass -c "irm https://chatgpt.com/codex/install.ps1 | iex" on Windows – with npm and Homebrew as the supported alternatives, and updating is codex update, which recognizes script, npm, and Homebrew installs and runs that channel’s upgrade.1411 The part most pages skip is what comes after the first command: which of the five install routes to pick, how to pin a version when a release breaks you, why the winget package runs days to weeks behind npm, and what an uninstall leaves behind in ~/.codex. This page is that reference, one table per job, current as of v0.163.0 (October 15, 2026).9
Updated October 15, 2026, for v0.163.0. Four things moved since this page’s September version. The winget index moved: after a summer in which its manifest requests sat for weeks, the twelve from 0.156.0 through 0.161.0 merged within a day of opening, but the 0.162.0 and 0.162.1 requests have waited since October 8 and 9, so on October 15 winget was three releases behind npm, against the fourteen (0.147.0 through 0.153.4) of September 6.310 Windows releases ship a signed install.ps1 (its SHA-256 check is older; v0.162.0 fixed it under Windows PowerShell).18 Windows also gained a third sandbox implementation, Microsoft Execution Containers, with the two September modes as its fallbacks.8 And the background server Codex now starts by default for eligible interactive sessions runs its own updater, which on older script installs can move the CLI’s own package.20 Every install, update and pin anchor below was re-read on October 15; the codex doctor reading is from 0.153.4.910
TL;DR
- The standalone installer is the route OpenAI leads with in both the README and the CLI docs, with npm and Homebrew presented as alternatives (“you can also install” in the CLI docs, “can also be installed via” in the README): the
install.shscript on macOS and Linux, theinstall.ps1script on Windows. It downloads the compiled binary, so it needs no Node.111 - npm and Homebrew are supported alternatives.
npm install -g @openai/codexpins with a plain package spec (@<version>);brew install --cask codexwas at the same 0.163.0 as npm when this was written; the cask bumped thirteen minutes after the release.1210 - winget works, days to weeks behind. OpenAI publishes the
OpenAI.Codexpackage. After a summer in which its manifest pull requests sat unmerged for weeks, the twelve from 0.156.0 (September 22, 2026) through 0.161.0 (October 7) each merged within a day of opening; then the 0.162.0 and 0.162.1 requests stalled, open since October 8 and 9. On October 15 the newest installable version was 0.161.0 against npm’s 0.163.0, three stable releases behind, with the 0.163.0 request open as well.310 codex updatecovers the script, npm, and Homebrew installs (v0.128.0 and later): it reuses the install-channel detection the TUI already has and runs the matching upgrade. A winget install is not a channel it recognizes; update that one withwinget upgrade OpenAI.Codex. The manual equivalents for the rest are re-running the installer,npm install -g @openai/codex@latest, orbrew upgrade --cask codex.411- The background server runs an updater, and on older script installs it can move your CLI. Since v0.157.0 (September 25, 2026 UTC) Codex starts a managed background server by default for eligible interactive sessions. When the installer selected the
latestchannel, that server checks for updates five minutes after it starts and then hourly, running the installer; a new daemon lives under~/.codex/packages/app-server-daemon, but a daemon first launched from an older script install keeps using~/.codex/packages/standalone/current, the CLI’s own package. The switch is"updater": { "autoUpdateEnabled": false }in~/.codex/app-server-daemon/settings.json, applied bycodex app-server daemon restart.2012 - Pin with
--release <version>oninstall.sh,$env:CODEX_RELEASEbefore theinstall.ps1line, or@<version>on npm. Homebrew’s cask tracks one current version and cannot pin.212 - Uninstalling the package does not remove your state, but on a script install
rm -rf ~/.codexalso deletes the CLI itself, because the installer keeps its releases under~/.codex/packages/standalone.12
How Do I Install Codex CLI?
Four routes in the order OpenAI’s own docs present them,111 plus winget on Windows, which OpenAI does not document:3
# Standalone installer, no Node required (macOS, Linux, WSL) -- the route OpenAI lists first
curl -fsSL https://chatgpt.com/codex/install.sh | sh
# Windows PowerShell
powershell -ExecutionPolicy ByPass -c "irm https://chatgpt.com/codex/install.ps1 | iex"
# npm (needs Node.js 16+; pins with a plain @version spec)
npm install -g @openai/codex
# Homebrew (macOS, Linux)
brew install --cask codex
# winget (Windows; lags npm, see the platform section)
winget install OpenAI.Codex
Then confirm it landed and sign in:
codex --version # codex-cli 0.163.0
codex login # ChatGPT account (recommended) or an API key
On a first script install the profile block only takes effect in new shells. If codex is not found in the terminal you installed from, run export PATH="$HOME/.local/bin:$PATH" there or open a new one; the installer prints the same two lines (“Current terminal” and “Future terminals”) when it finishes.12
Prefer a raw binary? Every GitHub release ships platform tarballs (codex-aarch64-apple-darwin.tar.gz, codex-x86_64-apple-darwin.tar.gz, codex-x86_64-unknown-linux-musl.tar.gz, codex-aarch64-unknown-linux-musl.tar.gz), and since v0.106.0 the same install.sh is attached to each release as an asset. Each archive holds a single entry with the platform baked into its name, so rename it to codex after extracting.15 The release page has grown around those tarballs: .zst and macOS .dmg siblings of each binary; codex-package-<target>.tar.gz bundles of the binary, the codex-code-mode-host helper and ripgrep, which are what the installer and the Homebrew cask download; the codex-app-server and codex-responses-api-proxy binaries; and openai_codex_cli_bin Python wheels, which are the pinned runtime for OpenAI’s Python SDK rather than a pip route to the CLI.512
The installer fetches from OpenAI-hosted release infrastructure: chatgpt.com/codex/install.sh redirects to releases.openai.com, a change that landed in v0.146.0, with GitHub Releases kept as the fallback host.6 On a network that blocks or throttles OpenAI’s artifact host but allows GitHub, fetch the script from the release asset and tell it to pull the binary from GitHub too:112
curl -fsSL https://github.com/openai/codex/releases/latest/download/install.sh | CODEX_INSTALLER_USE_RELEASES_OPENAI_COM=false sh
The variable goes on the sh side of the pipe. A VAR=value curl ... | sh form applies the variable to curl only, so the script never sees it and quietly keeps the default. In PowerShell, set $env:CODEX_INSTALLER_USE_RELEASES_OPENAI_COM = 'false' before running the install line.
Which route should you choose?
| You are on | Use | Why |
|---|---|---|
| macOS or Linux | the install script | The route OpenAI’s docs list first; downloads the binary, no Node on the machine11 |
| Windows | the PowerShell script | Native PowerShell with the Windows sandbox; WSL is optional811 |
| Any machine where you pin versions in scripts | npm install -g @openai/codex@<version> |
Pins as a package spec, so the version lives in your Dockerfile or provisioning script rather than in a flag10 |
| macOS or Linux, where Homebrew already manages everything else | brew install --cask codex |
The same version as npm on October 15 (the cask bumped thirteen minutes after the release), no Node dependency, brew upgrade keeps it current2 |
| Windows, package-managed | winget install OpenAI.Codex |
If lag behind npm is acceptable: three releases on October 153 |
Which Platforms Does Codex Support?
| Platform | Status |
|---|---|
| macOS, Apple silicon and Intel | Supported; binaries for both1 |
| Linux, x86_64 and arm64 | Supported; binaries for both1 |
| Windows 11 | Recommended baseline; MXC arrived in 24H2 (build 26100.9278) and 25H2 (build 26200.9278) and is rolling out, so test it with the one-command check8 |
| Windows 10, version 1809 or later | Best effort (ConPTY console support required)8 |
| Older Windows 10 | Not recommended: missing console components8 |
| WSL2 | Optional; OpenAI’s WSL page runs the same install script from the WSL shell14 |
On Windows, Codex runs natively in PowerShell with a Windows sandbox, and as of October 2026 there are three implementations. The newest is Microsoft Execution Containers (MXC), the process isolation Microsoft introduced in Windows 11 24H2 and 25H2: the desktop app prefers it for consumer accounts when the device supports it, the CLI uses it when prefer_mxc = true is set under [features], with the legacy modes as the fallback, or when [windows] sandbox = "mxc" selects it explicitly, which fails rather than falls back where the capability is missing or policy blocks it; from v0.162.0 a one-command test (codex -c windows.sandbox=mxc sandbox ..., expected output MXC_OK) tries it without changing the saved selection. The two earlier modes are now the legacy fallbacks. elevated is the preferred one: it uses dedicated lower-privilege sandbox users, filesystem permission boundaries, firewall rules, and local policy changes, and needs an administrator-approved setup. unelevated runs commands with a restricted Windows token derived from your user and ACL-based filesystem boundaries, with weaker network isolation.8 You select the fallback in config.toml:
[windows]
sandbox = "elevated" # or "unelevated"; "mxc" selects the containers explicitly
OpenAI’s guidance is to use the native sandbox by default and choose WSL when you need Linux-native tooling, when your workflow already lives in WSL2, or when none of the native Windows sandbox implementations meets your needs.8 One thing to keep straight: the Windows setup assumes winget is present on the machine for its own setup steps; that is separate from installing Codex through winget. OpenAI does publish that package – the release workflow has a winget job that opens a manifest pull request in microsoft/winget-pkgs for stable releases – and the index’s summer stall ended, though not for good. Dates here are UTC. The 0.148.0 through 0.152.0 requests, opened between August 18 and September 1, merged on September 11 (0.151.0 on September 30 and 0.149.1 on October 1); the 0.147.0 request closed unmerged, as did a community member’s 0.154.0 submission, and OpenAI’s workflow opened none for 0.152.1 or for 0.153.x through 0.155.x; from 0.156.0 (September 22) through 0.161.0 (October 7), twelve manifests in a row merged within a day of opening; then the 0.162.0 and 0.162.1 requests stalled, open since October 8 and 9. On October 15 the index held 138 versions, newest 0.161.0, three stable releases behind npm, with the 0.163.0 request open as well. Nothing about the CLI is broken; the package runs days to weeks behind.38
Node.js is only a requirement for the npm route. The install scripts download the compiled binary, and the Homebrew cask declares no dependencies.12
How Do I Update Codex CLI?
The CLI you run does not update itself, unless a background-server updater is managing the same package (older script installs whose server was launched from packages/standalone, below). The TUI notices a newer release and offers the command for your install channel; running it is on you, and the built-in one covers the script, npm, and Homebrew installs.4 The startup check itself is a config key: check_for_update_on_startup = false in config.toml, which the reference describes as “Check for Codex updates on startup (set to false only when updates are centrally managed)”; fleets that manage updates centrally set features.in_app_updates = false in requirements.toml.16
codex --version # what you run now
npm view @openai/codex version # newest published
codex update # built-in, v0.128.0+; detects your install channel
codex update arrived in v0.128.0 on April 30, 2026; the pull request that added it reused the install-channel detection and update runner the TUI already had for update prompts. The channel map covers npm (plus the bun, pnpm, and Vite+ variants), Homebrew, and the standalone installer on Unix and Windows; a winget install is not in it, so a winget-installed Codex updates through winget upgrade OpenAI.Codex only. Read again on October 15, the map has one new entry, a daemon action that replaces the local background server once the terminal is restored, and its standalone commands now run the installer with CODEX_NON_INTERACTIVE=1; winget is still absent.4 The manual equivalents, if you prefer them or are scripting a machine image:
curl -fsSL https://chatgpt.com/codex/install.sh | sh # standalone: re-run the installer
npm install -g @openai/codex@latest # npm
brew upgrade --cask codex # Homebrew
winget upgrade OpenAI.Codex # winget (to whatever winget has)
irm https://chatgpt.com/codex/install.ps1 | iex # standalone on Windows: re-run the installer
Releases land on a fast stable line – 0.160.0 through 0.163.0, six stable releases, shipped between October 1 and October 15, 2026 – so the gap between “what I run” and “newest” is often a week, not a quarter.9
The background server updates itself
The background server is the one thing that fetches new binaries on a schedule. Since v0.157.0 (September 25, 2026 UTC) Codex starts a managed background server by default for eligible interactive sessions, and when the installer selected the stable latest channel that server launches a detached updater loop: it checks for updates five minutes after it starts and then hourly, running the installer each time, and a running server restarts on the new binary. A daemon installed on 0.163.0 lives in its own package, ~/.codex/packages/app-server-daemon (the installer’s CODEX_INSTALL_DAEMON_ONLY=1 mode, which leaves the user’s CLI command and shell setup alone), but a daemon first launched from an older script install keeps using ~/.codex/packages/standalone/current, and its scheduled updates move that package, which is the CLI you type (on installs older than the installer’s channel marker, only after the next latest install, which codex update performs; until then the daemon serves without updating). A pinned release stays pinned: the installer writes an auto-update-version marker only for a latest install and removes it for an explicit release, and its own comment states the rule, “Scheduled updates still require the selected release to follow the latest channel.” The per-user switch is "updater": { "autoUpdateEnabled": false } in ~/.codex/app-server-daemon/settings.json, with an updateIntervalMinutes beside it; codex app-server daemon restart applies the enabled state, and a changed interval takes effect at the next wait; codex app-server daemon stop stops the server (a graceful termination request, then a forced one after the grace window; the updater loop is a separate pid-backed process, so check for it afterward), /daemon in the TUI restarts it (v0.163.0), and those updates obey the application’s network policy (v0.163.0). An explicit codex app-server daemon update selects the latest stable release even with automatic updates off and, once the installer and release support it, moves a legacy daemon onto its own package root; it also returns a pinned package to production update eligibility (the automatic-update setting itself is kept) and restarts a running server, which may interrupt active or queued work; a stopped server stays stopped. The daemon’s own README calls it experimental.2012
How Do I Install a Specific Version?
npm and the install script both pin by version; Homebrew does not:212
npm install -g @openai/[email protected] # npm: exact version
curl -fsSL https://chatgpt.com/codex/install.sh | sh -s -- --release 0.162.1 # script: --release flag
curl -fsSL https://chatgpt.com/codex/install.sh | CODEX_RELEASE=0.162.1 sh # script: env var, on the sh side
winget install OpenAI.Codex --version 0.161.0 # winget: only what it has
codex --version # verify the rollback took
Mind the placement in the env-var form: CODEX_RELEASE=0.162.1 must sit in front of sh, after the pipe. Written in front of curl, the variable applies to curl alone and the script installs latest while you believe you pinned.12 On Windows the PowerShell script declares $Release = $env:CODEX_RELEASE as its only parameter and falls back to latest when it is empty, so the pin is the variable, set in the same session:17
$env:CODEX_RELEASE = '0.162.1'; irm https://chatgpt.com/codex/install.ps1 | iex
Clear it afterward (Remove-Item Env:CODEX_RELEASE): the variable stays set for the rest of that session, and a later installer run in it, including the one codex update launches, inherits the pin.17
npm also carries an alpha dist-tag for the prerelease line (0.163.0-alpha.11 on October 15, published October 14 UTC, nearly two days before the stable 0.163.0); npm install -g @openai/codex@alpha follows it, and since v0.161.0 publishing an older alpha or a hotfix no longer moves that tag backward.1021
Pinning is the right move when a release breaks you: file the issue, pin the last good version, move on. Verify with codex --version after every pin, because a second install elsewhere on your PATH keeps serving its own binary in silence. The install script checks for exactly this: when it finds a Homebrew-, npm-, or bun-managed codex already on your PATH, it warns that “Multiple managed Codex installs can be ambiguous because PATH order decides which one runs” and offers to run the matching uninstall for you; it recognizes the Homebrew case by the macOS prefixes /opt/homebrew and /usr/local, on macOS only, so a Linuxbrew codex is not caught.12 codex doctor reports the same condition under Environment after the fact.7
How Do I Uninstall Codex CLI?
Stop the background server first, while codex is still on your PATH, then remove it with the route that installed it:
codex app-server daemon stop # first; skip if no server runs
npm uninstall -g @openai/codex
brew uninstall --cask codex
winget uninstall OpenAI.Codex
A script install has no package manager to ask. The installer puts a codex symlink in ~/.local/bin (override with CODEX_INSTALL_DIR) that points at the binary inside ~/.codex/packages/standalone/current (current/bin/codex on current releases); current is itself a symlink into ~/.codex/packages/standalone/releases/, where each downloaded release lives. On macOS the installer adds a second symlink, codex-code-mode-host, beside the first.12 Since v0.157.0 there may also be a background server: its package under ~/.codex/packages/app-server-daemon (or, for a server first launched from an older install, the standalone package itself) and its state under ~/.codex/app-server-daemon/ (settings.json, daemon.pid and daemon-updater.pid, or app-server.pid and app-server-updater.pid for a server running from the standalone package, and daemon.lock).20 Stop it first, then remove all of it:
codex app-server daemon stop # the background server; its updater is a separate process
pgrep -fl "app-server" || true # what is still running
grep -H . ~/.codex/app-server-daemon/*.pid 2>/dev/null # the recorded pids, by file
The server runs as codex app-server --listen unix://, with --remote-control before --listen when remote control is on (the listen argument is the bare scheme; no socket path appears on the command line), and its updater as codex app-server daemon pid-update-loop; the pid files under ~/.codex/app-server-daemon/ are the test for which process belongs to the background server: daemon.pid and daemon-updater.pid for a dedicated daemon, app-server.pid and app-server-updater.pid for a server running from the standalone package. stop ends the server, not the updater, which keeps waking on its interval until a reboot, so if a pid recorded there is still alive, end it with kill <pid> now; any other codex app-server process belongs to something else you are running. Then remove the rest:1220
rm -f ~/.local/bin/codex ~/.local/bin/codex-code-mode-host # the second link exists on macOS installs only
rm -rf ~/.codex/packages/standalone ~/.codex/packages/app-server-daemon # the CLI's package and the server's
rm -rf ~/.codex/app-server-daemon # the server's settings, pid files and lock
If ~/.local/bin was not on your PATH when you installed, or the installer found a competing Homebrew, npm, or bun install and rewrote the entry, the script also appended a marked block to your shell profile: # >>> Codex installer >>> through # <<< Codex installer <<< in ~/.zprofile (macOS zsh), ~/.bash_profile (macOS bash), ~/.zshrc (Linux zsh), ~/.bashrc (Linux bash), or ~/.profile (any other shell). Delete those three lines to finish.12
On Windows, install.ps1 keeps the same layout under %USERPROFILE%\.codex\packages\standalone (or %CODEX_HOME%\packages\standalone if you set that variable): downloaded releases in releases\, a current junction pointing at the active one. It exposes codex.exe through %LOCALAPPDATA%\Programs\OpenAI\Codex\bin (override with CODEX_INSTALL_DIR), which is itself a junction into current\bin, and instead of a profile block it writes that bin path into your user PATH for future PowerShell sessions. The background server keeps the same two folders there, packages\app-server-daemon and app-server-daemon.1720 Stop it, remove the standalone directory and the server’s two folders, then the now-dangling bin junction, then take the entry back out of the user Path variable under Environment Variables:17
codex app-server daemon stop # the background server; its updater is a separate process
Get-Process codex* -ErrorAction SilentlyContinue # what is still running
Get-ChildItem "$env:USERPROFILE\.codex\app-server-daemon\*.pid" -ErrorAction SilentlyContinue | ForEach-Object { "$($_.Name): $(Get-Content $_)" } # the recorded pids, by file
The same pid files decide here: if a process whose pid is recorded in %USERPROFILE%\.codex\app-server-daemon\daemon.pid or daemon-updater.pid (or app-server.pid and app-server-updater.pid for a server on the standalone package) is still alive, end it with Stop-Process -Id <pid> now; any other Codex process is something else you are running. Then remove the rest:20
Remove-Item -Recurse -Force "$env:USERPROFILE\.codex\packages\standalone" # releases plus the current junction
Remove-Item -Recurse -Force "$env:USERPROFILE\.codex\packages\app-server-daemon", "$env:USERPROFILE\.codex\app-server-daemon" -ErrorAction SilentlyContinue # the server's package and state
cmd /c rmdir "$env:LOCALAPPDATA\Programs\OpenAI\Codex\bin" # the bin junction; rmdir removes the link, not a target
codex sandbox uninstall (v0.162.0) is the separate cleanup for the legacy Windows sandbox: it removes the machine-wide sandbox accounts and network rules with administrator privileges, leaves Codex home and the sandbox directories alone, and is rejected on other platforms.19
On any route, stop the background server first if one is running (codex app-server daemon stop) and look for ~/.codex/packages/app-server-daemon: the daemon’s README says bootstrap copies the invoking package into that folder when no daemon package exists and that a bare executable cannot supply one, and whether a Homebrew or npm install’s automatic start creates it was not tested here; if the folder exists, remove it and ~/.codex/app-server-daemon after the package-manager uninstall.20 The package-manager uninstalls above do not touch ~/.codex/. Homebrew’s --zap does not either, in practice: the cask’s only zap stanza is rmdir: "~/.codex", and Homebrew applies rmdir: only to directories that are already empty.2 That directory holds config.toml, your stored credentials, and every session, which is why a reinstall picks up your login and history where you left them. Delete it only when you want a genuinely clean slate, and know what that means on a script install:
rm -rf ~/.codex # discards config.toml, credentials, all sessions -- AND the CLI itself on a script install
A clean reinstall that keeps your state is one line on npm: npm uninstall -g @openai/codex && npm install -g @openai/codex@latest. On the script route, re-running the installer adds the new release under ~/.codex/packages/standalone/releases, repoints current at it, leaves the older releases in place until you remove them, and leaves your config alone.12
The Whole Lifecycle in One Table
| Job | install.sh (macOS, Linux) | install.ps1 (Windows) | npm | Homebrew | winget |
|---|---|---|---|---|---|
| Install | curl -fsSL https://chatgpt.com/codex/install.sh \| sh |
powershell -ExecutionPolicy ByPass -c "irm https://chatgpt.com/codex/install.ps1 \| iex" |
npm install -g @openai/codex |
brew install --cask codex |
winget install OpenAI.Codex |
| Update | codex update, or re-run the script |
codex update, or re-run the script |
codex update, or npm install -g @openai/codex@latest |
codex update, or brew upgrade --cask codex |
winget upgrade OpenAI.Codex (codex update does not recognize this route) |
| Pin | sh -s -- --release 0.162.1 |
$env:CODEX_RELEASE = '0.162.1' before the install line |
npm install -g @openai/[email protected] |
not supported | winget install OpenAI.Codex --version 0.161.0 |
| Uninstall | codex app-server daemon stop, then remove the ~/.local/bin symlinks, ~/.codex/packages/standalone, ~/.codex/packages/app-server-daemon and ~/.codex/app-server-daemon |
codex app-server daemon stop, then remove %USERPROFILE%\.codex\packages\standalone, the server’s packages\app-server-daemon and app-server-daemon folders, the %LOCALAPPDATA%\Programs\OpenAI\Codex\bin junction, and the user PATH entry |
codex app-server daemon stop if a server runs, then npm uninstall -g @openai/codex, then the daemon folders if present |
the same stop, then brew uninstall --cask codex (--zap does not clear a populated ~/.codex), then the daemon folders if present |
the same stop, then winget uninstall OpenAI.Codex, then the daemon folders if present |
| Check | codex --version, codex doctor |
same | same | same | same |
What Does codex doctor Check?
codex doctor is the command to run before filing a bug or debugging an install that “worked yesterday.” On 0.153.4 it captures seven sections in one report – Notes, Environment (runtime and install consistency), Configuration (config.toml load status, auth, MCP, sandbox policy), Desktop App (added in v0.149.0), Updates, Connectivity, and Background Server – with --summary for a compact view, --json for a redacted machine-readable form, --all to expand truncated lists, and --no-color for logs; codex doctor --help on 0.153.4 also lists --ascii; v0.162.0 added the configured TUI mode to the report.7131522 Most “Codex is broken” reports resolve to something it names on the first screen: a stale auth mode, a config.toml that failed to parse, or a second install shadowing the one on your PATH. The full section-by-section breakdown lives in the guide.
What Changes After Install
The first thing a fresh install trips over is not the binary. Since v0.149.0 the CLI refuses to start on approval_policy = "untrusted", so a config.toml copied from an older machine needs one edit.13 Coming from Claude Code? The migration post maps the two configs side by side, and the hooks post covers what Codex runs around the model. The Codex CLI guide is the full reference: sandbox and approval modes, AGENTS.md, MCP, skills, and cloud tasks. And if you run both tools, the Claude Code install page is this page’s twin.
FAQ
How do I update Codex CLI to the latest version?
Run codex update (v0.128.0 and later); it detects whether you installed through the script, npm, or Homebrew and runs that channel’s upgrade. The manual equivalents are re-running the install script, npm install -g @openai/codex@latest, or brew upgrade --cask codex. A winget install is not a channel codex update recognizes; use winget upgrade OpenAI.Codex for that one.
Does Codex CLI update automatically?
The CLI does not, with one exception. The TUI checks for a newer release and offers the update command that matches your install channel, and codex update (v0.128.0 and later) runs it. The exception is the background server Codex starts by default since v0.157.0: on the latest channel it checks for updates five minutes after starting and then hourly, and a server first launched from an older script install updates ~/.codex/packages/standalone, the CLI’s own package, once a latest install has recorded the channel. Set "updater": { "autoUpdateEnabled": false } in ~/.codex/app-server-daemon/settings.json and run codex app-server daemon restart to stop that.
How do I uninstall Codex CLI?
Stop the background server first if one is running (codex app-server daemon stop), then use the route that installed it: npm uninstall -g @openai/codex, brew uninstall --cask codex, or winget uninstall OpenAI.Codex, and look for ~/.codex/packages/app-server-daemon and ~/.codex/app-server-daemon, which a package-manager uninstall leaves behind. For a script install, the same stop, then remove the ~/.local/bin/codex symlink (and ~/.local/bin/codex-code-mode-host on macOS), the ~/.codex/packages/standalone directory, and the server’s ~/.codex/packages/app-server-daemon and ~/.codex/app-server-daemon. On Windows the script install is %USERPROFILE%\.codex\packages\standalone (plus the server’s packages\app-server-daemon and app-server-daemon folders), the %LOCALAPPDATA%\Programs\OpenAI\Codex\bin junction, and an entry in your user PATH; remove all of them. Your config, credentials, and sessions stay in ~/.codex/ until you remove the rest of that directory yourself.
How do I install Codex CLI on Windows?
Run powershell -ExecutionPolicy ByPass -c "irm https://chatgpt.com/codex/install.ps1 | iex". The CLI runs natively in PowerShell with a Windows sandbox (Microsoft Execution Containers when you set prefer_mxc = true and the device supports it, otherwise your configured legacy mode, elevated when none is set; selecting [windows] sandbox = "mxc" explicitly uses MXC or fails, with no fallback); WSL2 is an option when you need Linux tooling or none of the sandbox implementations fits, not a requirement. Windows 11 is the recommended baseline. winget install OpenAI.Codex also works but trails the stable line.
Do I need Node.js to install Codex?
Only for the npm route, and the package asks for Node 16 or later. The install script, the PowerShell script, and the Homebrew cask all provide the compiled codex binary, so a machine without Node can run Codex.
How do I check which version of Codex I have?
codex --version prints it (for example codex-cli 0.163.0). npm view @openai/codex version shows the newest published version, and codex doctor reports the install path and whether another copy on your PATH is shadowing it.
-
OpenAI, openai/codex README – the install section leads with
curl -fsSL https://chatgpt.com/codex/install.sh | shfor macOS and Linux and the PowerShellinstall.ps1one-liner for Windows, then says the CLI “can also be installed via” npm (npm install -g @openai/codex) and Homebrew (brew install --cask codex); documentscurl -fsSL https://chatgpt.com/codex/install.sh | CODEX_INSTALLER_USE_RELEASES_OPENAI_COM=false shand the$env:CODEX_INSTALLER_USE_RELEASES_OPENAI_COM='false'PowerShell form, introduced with “To force GitHub Releases, setCODEX_INSTALLER_USE_RELEASES_OPENAI_COMtofalse(0andnoare also accepted)”; the@openai/codexpackage name; platform binaries for macOS (Apple silicon, x86_64) and Linux (x86_64, arm64) on GitHub Releases. Verified 2026-09-06 and again 2026-10-15, when the install section was unchanged apart from the sentence quoted in note 6. ↩↩↩↩↩↩↩↩↩ -
Homebrew, cask
codex– cask tokencodex, a single current version (0.163.0 on 2026-10-15, bumped by thecodex 0.163.0commit to Homebrew/homebrew-cask at 21:44:02 UTC, thirteen minutes after the 21:30:38 UTC GitHub release), abin/codexbinary artifact with shell completions generated from it, an emptydepends_on, supported platforms that includex86_64_linuxandarm64_linuxbeside the macOS releases, and a download URL ofcodex-package-aarch64-apple-darwin.tar.gzon the GitHub release. Verified via the formulae API and the homebrew-cask commit list 2026-10-15 (0.153.4 on 2026-09-06). The cask’s zap stanza iszap rmdir: "~/.codex", and the Cask Cookbook definesrmdir:as paths of directories to remove if empty. ↩↩↩↩↩↩ -
Microsoft, winget-pkgs manifests for
OpenAI.Codex– 138 published versions, newest 0.161.0, on 2026-10-15 (119 and 0.146.1 on 2026-09-06); no manifest for 0.147.0, 0.152.1, or 0.153.x through 0.155.x. The package is published by OpenAI:.github/workflows/rust-release.ymlin openai/codex has awingetjob that submits the manifest withkomac(its comment: “Adapted from the WinGet Releaser version previously used by this job”; re-read 2026-10-15). The pull requests, from the repository’s search on 2026-10-15, dates in UTC, byoai-fork-botunless noted: 0.147.0 (#413497) closed unmerged; 0.148.0 (#420225) through 0.152.0 (#427090), opened August 18 to September 1, merged September 11 except 0.151.0 (#426091) on September 30 and 0.149.1 (#423060) on October 1; 0.154.0 (#435129, opened by a community member,z3oya) closed unmerged; 0.156.0 (#439266) through 0.161.0 (#448267), twelve requests opened September 22 to October 7, each merged the day it opened or the next; 0.162.0 (#449062), 0.162.1 (#449772) and 0.163.0 (#453561) open on 2026-10-15. OpenAI’s README and CLI docs do not mention winget. ↩↩↩↩↩ -
OpenAI, Codex CLI v0.128.0 release notes, April 30, 2026 – “Added
codex update, configurable TUI keymaps, plan-mode nudges, action-required terminal titles, and active-turn/statuslineand/titleedits.” The command’s pull request, openai/codex #19933 (merged April 28, 2026), states it “Reused the existing install-channel detection and update command runner that the TUI already uses for update prompts.” The channel map iscodex-rs/tui/src/update_action.rs: npm and its bun, pnpm, and Vite+ siblings, Homebrew, and the standalone installer (Unix and Windows); no winget variant (read 2026-09-06). Re-read 2026-10-15: the enum gainedDaemon(DaemonUpdateSource)(“Replace the local daemon after restoring the terminal”), and the standalone commands arecurl -fsSL https://chatgpt.com/codex/install.sh | CODEX_NON_INTERACTIVE=1 shand$env:CODEX_NON_INTERACTIVE=1; irm https://chatgpt.com/codex/install.ps1 | iex; still no winget variant. ↩↩↩↩ -
OpenAI, Codex CLI v0.106.0 release notes, February 26, 2026 – “Added a direct install script for macOS and Linux and publish it as a GitHub release asset, using the existing platform payload (including
codexandrg)”;install.shis attached to every release since. The rust-v0.163.0 release (assets listed through the GitHub releases API, 2026-10-15) carriesinstall.shandinstall.ps1, the per-platformcodex-<target>.tar.gz,.zstand macOS.dmgfiles,codex-package-<target>.tar.gzbundles withcodex-package_SHA256SUMS,codex-app-server-*andcodex-responses-api-proxy-*binaries,codex-npm-*.tgztarballs and sixopenai_codex_cli_bin-0.163.0-*.whlfiles; PyPI describesopenai-codex-cli-binas “Pinned Codex CLI runtime for the Python SDK”. The macOS arm64 tarball downloaded 2026-10-15 holds the single entrycodex-aarch64-apple-darwin. ↩↩ -
OpenAI, Codex CLI v0.146.0 release notes, July 29, 2026 – “Publish release artifacts, channel metadata, and installer aliases through OpenAI-hosted release infrastructure, with GitHub fallback.”
https://chatgpt.com/codex/install.shanswers 302 tohttps://releases.openai.com/codex/install.sh(checked 2026-09-06 and 2026-10-15); the README stated it on 2026-10-15: “The standalone installers download fromhttps://releases.openai.com/codexby default and fall back to GitHub Releases if a metadata or asset download is unavailable.” ↩ -
OpenAI,
feat(cli): add codex doctor diagnostics, openai/codex PR #22336, merged May 13, 2026 – the report’s sections (Notes, Environment, Configuration, Updates, Connectivity, Background Server) and its--summary,--json,--all, and--no-colorflags. ↩↩ -
OpenAI, Codex on Windows: Windows sandbox – as read 2026-10-15: Microsoft Execution Containers, “which Microsoft is rolling out to Windows 11 devices. Microsoft introduced MXC process isolation in Windows 11 24H2 (build 26100.9278) and 25H2 (build 26200.9278)”; “The desktop app automatically prefers MXC for consumer accounts when the device supports it”, and
prefer_mxc = trueunder[features]for the CLI;allow_mxc = falseunder[windows]inrequirements.tomlblocks it; a one-command test documented for “Codex CLI 0.162.0 and later” with the expected outputMXC_OK; the legacy fallbacks[windows] sandbox = "elevated"(“the preferred legacy fallback”) and"unelevated"(“a legacy fallback” with “weaker network isolation than elevated”); “Use MXC when the device and policy support it. Otherwise, prefer elevated, with unelevated as a secondary fallback”; “Use the native Windows sandbox by default. Choose WSL when you need Linux-native tooling, your workflow already lives in WSL2, or the available native Windows implementations don’t meet your needs”; Windows 11 recommended, “Recent, fully updated Windows 10” labeled “Best effort” with “Windows 10 version 1809 or newer is required” for console support, older Windows 10 not recommended;wingetexpected to be available for setup. First verified 2026-09-06, when the page described only the two legacy modes. ↩↩↩↩↩↩↩↩ -
OpenAI, openai/codex releases –
rust-v0.163.0published October 15, 2026 at 21:30 UTC as the latest release, afterrust-v0.160.0(October 1),rust-v0.160.1(October 5),rust-v0.161.0(October 7),rust-v0.162.0(October 8) andrust-v0.162.1(October 9);rust-v0.153.4was the latest on September 4, 2026 (from the September 6 read; the October 15 listing goes back to October 1). Dates from the GitHub releases API. ↩↩↩ -
npm,
@openai/codex–latest= 0.163.0 (published 2026-10-15 21:37 UTC),alpha= 0.163.0-alpha.11 (published 2026-10-14 03:38 UTC), andengines: { node: ">=16" }on 0.163.0, from the registry document on 2026-10-15;latestwas 0.153.4 on 2026-09-06, and the document’stimemap lists fourteen stable versions after 0.146.1 through 0.153.4 (0.147.0, 0.148.0, 0.149.0, 0.149.1, 0.150.0, 0.150.1, 0.151.0, 0.152.0, 0.152.1, 0.153.0 to 0.153.4). ↩↩↩↩↩↩ -
OpenAI, Codex CLI documentation – installation leads with the standalone installer (
curl -fsSL https://chatgpt.com/codex/install.sh | shon macOS and Linux, a Windows installer tab), presents Homebrew and npm as alternatives, and gives re-running the installer as the update for standalone installs. Verified 2026-09-06 and again 2026-10-15, when the installation tabs were macOS/Linux, Windows, npm and Homebrew. ↩↩↩↩↩↩ -
OpenAI, the
install.shinstaller script as served 2026-09-06 and re-read 2026-10-15 –Usage: install.sh [--release VERSION]; environment variablesCODEX_RELEASE(“Version to install; overridden by –release”),CODEX_INSTALL_DIR(default~/.local/bin),CODEX_HOME(default~/.codex), andCODEX_INSTALLER_USE_RELEASES_OPENAI_COM(“Set to 0, false, or no to use GitHub Releases”); releases stored under~/.codex/packages/standalone/releasesbehind acurrentsymlink, with acodexsymlink (andcodex-code-mode-hoston macOS) in the bin directory; a# >>> Codex installer >>>/# <<< Codex installer <<<PATHblock appended to~/.zprofile,~/.bash_profile,~/.zshrc,~/.bashrc, or~/.profilewhen the bin directory is not already onPATHor a competing managed install was detected (add_to_pathreturns early on aPATHmatch only when no conflict was found); and the conflicting-install check that warns “Multiple managed Codex installs can be ambiguous because PATH order decides which one runs” and offersbrew uninstall --cask codex,npm uninstall -g @openai/codex, orbun remove -g @openai/codex. The 2026-10-15 copy addsCODEX_NON_INTERACTIVE(“Set to 1, true, or yes to skip prompts”) to the usage text; a daemon-only mode (CODEX_INSTALL_DAEMON_ONLY=1, root~/.codex/packages/app-server-daemon, updater recordapp-server-daemon/daemon-updater.pid, marker fileauto-update-version, written for alatestinstall and removed for an explicit release at the end of the script) with the comment “An explicit daemon update may leave a local or pinned release. Scheduled updates still require the selected release to follow the latest channel.” on the guard that exits when the selected release is not the recorded one; and a preference for thecodex-package-<target>.tar.gzasset verified againstcodex-package_SHA256SUMS, with the platform npm tarball as the legacy layout. The bundle’sbin/codex,bin/codex-code-mode-hostandcodex-path/rgare made executable, and thecodex-code-mode-hostlink is created on macOS only; the updater runs as the subcommandapp-server daemon pid-update-loop(the script’s ownership check at line 1266 invokes it with--check-package-ownership). ↩↩↩↩↩↩↩↩↩↩↩↩↩↩ -
OpenAI, Codex CLI v0.149.0 release notes, August 20, 2026 – includes #39630, “Retire the untrusted approval policy,” and “
codex doctornow diagnoses endpoint protection, network/proxy failures, desktop app state, and update connectivity.” ↩↩ -
OpenAI, Codex on Windows: WSL, re-verified 2026-10-15 – “Use Codex CLI with WSL”:
wsl --install, open a WSL shell, thencurl -fsSL https://chatgpt.com/codex/install.sh | shandcodex; the page also advises keeping repositories under the Linux home directory rather than Windows-mounted/mnt/c/paths, for faster I/O. ↩ -
Author’s reproduction on Codex CLI 0.153.4 (npm install), 2026-09-06:
codex doctor --summary --no-colorprints the sections Notes, Environment, Configuration, Desktop App, Updates, Connectivity, and Background Server, in that order;codex doctor --helplists--ascii. ↩ -
OpenAI, Codex config reference –
check_for_update_on_startup(boolean): “Check for Codex updates on startup (set to false only when updates are centrally managed)”;features.in_app_updates(boolean): “Set to false in requirements.toml to disable in-app updates. Updates remain enabled by default when this requirement is omitted.” Verified 2026-09-06 and 2026-10-15. ↩ -
OpenAI, the
install.ps1installer script as served 2026-09-06 and re-read 2026-10-15 – parameter blockparam([string]$Release = $env:CODEX_RELEASE)withlatestas the fallback;$codexHome=CODEX_HOMEor%USERPROFILE%\.codex;packages\standalonewithreleases\, acurrentjunction andinstall.lock; the visible bin directory%LOCALAPPDATA%\Programs\OpenAI\Codex\bin(orCODEX_INSTALL_DIR) created as a junction tocurrent\bin; the user-scopePathwritten with[Environment]::SetEnvironmentVariable("Path", ..., "User")(“PATH updated for future PowerShell sessions.”). The 2026-10-15 copy computes the archive’s SHA-256 with .NET (SHA256CryptoServiceProvider) and compares it with the release’scodex-package_SHA256SUMS, throwing “Downloaded Codex archive checksum did not match expected digest” on a mismatch. ↩↩↩↩ -
OpenAI, Codex CLI v0.162.0 release notes, October 8, 2026 – “Publish a signed PowerShell installer with Windows releases. (#51158)” and “Fix archive checksum verification when installing through Windows PowerShell with PowerShell 7 module paths present. (#51257)”. PR #51158, merged October 5, 2026: “sign
scripts/install/install.ps1with Azure Trusted Signing in the x64 release job” and “publish the signed artifact asinstall.ps1instead of copying the unsigned source”. PR #51257, merged October 6: “compute SHA-256 directly with .NET APIs after resolving the archive path”. ↩ -
OpenAI,
Add a CLI command to uninstall the legacy Windows sandbox, openai/codex PR #50437, merged October 2, 2026, and listed in the v0.162.0 release notes; the pull request’s description: “Addcodex sandbox uninstallto remove machine-wide legacy Windows sandbox accounts and network rules with administrator privileges. Run cleanup without loading configuration, preserving Codex home, sandbox directories, and filesystem permissions. Reject the command on other platforms.” ↩ -
OpenAI,
codex-rs/app-server-daemon/README.mdat tag rust-v0.163.0 – “codex-app-server-daemonis experimental and its lifecycle contract may change”; the eight commands (codex app-server daemon start,restart,update,enable-remote-control,disable-remote-control,stop,version,bootstrap --remote-control); “Eligible managed daemons check for updates after five minutes, then hourly by default. EditCODEX_HOME/app-server-daemon/settings.jsonto change this” with the example"updater": { "autoUpdateEnabled": false, "updateIntervalMinutes": 120 }; “It launches a detached updater loop when automatic updates are enabled, the installer selected the stablelatestchannel, and the managed binary supports the updater command”; “New daemons useCODEX_HOME/packages/app-server-daemon/current/bin/codex” and “Daemon-only installer updates leave the user’s CLI command and shell setup alone”; “Previously launched legacy daemons retainCODEX_HOME/packages/standalone/current, including its flat binary layout when present. Starts and scheduled updates keep using that location”; the situations table (“the selected release stays pinned” when the installer selected an explicit release; “the running server restarts with the new binary before the updater replaces itself”); the state files underCODEX_HOME/app-server-daemon/as the README lists them (settings.json,app-server.pid,app-server-updater.pid,daemon.lock; the dedicated daemon’sdaemon.pidanddaemon-updater.pidcome from the source, below); “stopsends a graceful termination request first, then force-terminates the process after the configured grace window if it is still alive”; “installs made before the installer recorded channel selections need one newlatestinstallation to opt into automatic updates; until then the daemon continues to serve app-server without updating the selected release”; “daemon updateselects the latest stable release, even with automatic updates disabled. It also returns pinned or local managed packages to production update eligibility”, “A running daemon restarts, so active or queued work may be interrupted” and “Legacy installations migrate to the dedicated root once the published installer and release support migration”; “bootstrapcan use any complete CLI package. If no daemon package is installed, it copies the invoking package intoCODEX_HOME/packages/app-server-daemon” and “A bare executable cannot supply a new installation”. The pid-file names come from the source at the same tag,codex-rs/app-server-daemon/src/lib.rs:LEGACY_PID_FILE_NAME = "app-server.pid",LEGACY_UPDATE_PID_FILE_NAME = "app-server-updater.pid",DAEMON_PID_FILE_NAME = "daemon.pid",DAEMON_UPDATE_PID_FILE_NAME = "daemon-updater.pid"(lines 54 to 57), the legacy pair chosen only when the managed binary is underpackages/standalone(lines 334 to 337 and 376 to 379), andstopstopping the running backend (line 615) and the updater stopped byensure_managed_updateron a start, restart or remote-control change (lines 893 to 930) and on two other lifecycle paths (lines 474 to 477 and 829 to 832), never bystop, with the README’s “the updater loop is not reboot-persistent” (line 145); the command lines fromsrc/backend/pid.rs(lines 385 to 401:app-server --listen unix://for the server,app-server --remote-control --listen unix://with remote control on,app-server daemon pid-update-loopfor the updater). Also OpenAI, Codex CLI v0.157.0 release notes, published September 25, 2026 at 02:31 UTC – “Enabled automatic background-server startup for eligible interactive sessions, with recovery choices when server settings are incompatible. (#47179, #47318)”; v0.162.0 – “#50499 Include installer stderr in daemon update failures”, whose pull request opens “Daemon updates discard installer stderr”; v0.163.0, October 15 – “Restart a managed background server from/daemon. Codex warns about work the restart could interrupt, then reconnects automatically. (#53173)” and “#52223 Enforce application network policy for daemon updates”. The installer’s daemon mode and its update guard are in note 12. ↩↩↩↩↩↩↩↩ -
OpenAI, Codex CLI v0.161.0 release notes, October 7, 2026 – “Publishing an older alpha or hotfix no longer moves npm alpha tags backward. (#49704)”. ↩
-
OpenAI, Codex CLI v0.162.0 release notes – “#50200 Report the configured TUI mode in
codex doctor”. ↩