GuidesHosting choices

Install Codex CLI on macOS, Linux and Windows

Install OpenAI's Codex CLI with the install script, npm or Homebrew on macOS, Linux and Windows, sign in, and fix codex: command not found.

November 25, 2026The Everpod team
The short answer

On macOS or Linux, run curl -fsSL https://chatgpt.com/codex/install.sh | sh; on Windows, run OpenAI’s PowerShell installer, irm https://chatgpt.com/codex/install.ps1 | iex (the full line is below). Neither needs Node. With Node.js 16 or newer you can instead run npm install -g @openai/codex, and on Homebrew it is a cask: brew install --cask codex. Open a new terminal, check with codex --version (0.172.0 is the latest release, published November 24, 2026), then run codex in a project folder and choose Sign in with ChatGPT. On a machine with no browser, sign in with codex login --device-auth.

Pick an install method

Every route installs the same program, a native binary; they differ in what they need and how they update. As of 0.172.0, from the repository’s README:

MethodCommandNeedsLands in
Install script (macOS, Linux)
curl -fsSL https://chatgpt.com/codex/install.sh | shcurl~/.local/bin/codex
Install script (Windows)
the PowerShell line under Windows, below64-bit Windows%LOCALAPPDATA%\Programs\OpenAI\Codex\bin
npm
npm install -g @openai/codexNode.js 16+npm’s global bin
Homebrew
brew install --cask codexHomebrew$(brew --prefix)/bin/codex
Release archive
download, extract, renamenothingwherever you put it

OpenAI’s CLI docs lead with the script, “the standalone installer for macOS and Linux”, and it is the one that keeps Codex entirely in your home folder, so neither installing nor updating ever needs sudo. Use npm if you already manage tools through it, and Homebrew if that is how your Mac is kept.

The install script on macOS and Linux

curl -fsSL https://chatgpt.com/codex/install.sh | sh
Copied

Reading the script as served in November 2026: it supports x86_64 and arm64 on macOS and Linux, keeps the releases under ~/.codex, and links codex into ~/.local/bin (CODEX_INSTALL_DIR picks another folder). If that folder is not on your PATH, it adds an export PATH line, between # >>> Codex installer >>> markers, to one shell file:

System and shellFile it edits
macOS, zsh
~/.zprofile
macOS, bash
~/.bash_profile
Linux, bash
~/.bashrc
Linux, zsh
~/.zshrc
Anything else
~/.profile

It ends with “Codex CLI 0.172.0 installed successfully.” and two hints: a Current terminal: line with the export to paste into the window you are in, and “Future terminals: open a new terminal and run: codex”. The installers download from releases.openai.com and, per the README, “fall back to GitHub Releases if a metadata or asset download is unavailable.” To pin a version, pass it in CODEX_RELEASE; updating Codex has the forms for that and for going back one.

Piping a script into sh runs whatever the server sends. If you would rather read it first, download it, look, then run it:

curl -fsSL https://chatgpt.com/codex/install.sh -o codex-install.sh
less codex-install.sh
sh codex-install.sh
Copied

npm

npm install -g @openai/codex
Copied

The package declares Node >=16. It is a small launcher; the program itself comes as a per-platform optional dependency, with builds for Linux, macOS and Windows on x64 and arm64. If optional dependencies were skipped, the launcher stops with Missing optional dependency @openai/codex-linux-x64 (or your platform’s name) and prints the reinstall command to run.

Where it lands depends on how Node was installed. With Node from a system package, npm’s global folder belongs to root, so the install needs sudo and so does every update; without it, npm fails with EACCES: permission denied. With nvm or another version manager, the global folder is in your home and no sudo is needed, but codex is only on PATH in shells where that Node version is active. What npm install -g does covers the global folder in full.

Homebrew

brew install --cask codex
Copied

Codex is published as a cask, not a formula: Homebrew’s formula index has no codex, so use the --cask form the README gives. The cask was at 0.172.0 on November 25, links codex into Homebrew’s bin, and lists Linux builds for x86_64 and arm64 beside the macOS ones. Update it with brew upgrade --cask codex.

A release archive, by hand

Each GitHub release carries single-binary archives. The README names four: codex-aarch64-apple-darwin.tar.gz (Apple Silicon), codex-x86_64-apple-darwin.tar.gz (Intel Mac), codex-x86_64-unknown-linux-musl.tar.gz and codex-aarch64-unknown-linux-musl.tar.gz. The file inside keeps the platform in its name, so rename it:

tar -xzf codex-x86_64-unknown-linux-musl.tar.gz
mkdir -p ~/.local/bin
mv codex-x86_64-unknown-linux-musl ~/.local/bin/codex
codex --version
Copied

Nothing updates a binary placed this way, and codex update cannot tell how it was installed; you download the next archive yourself.

Windows

Codex runs natively on Windows 11, and on a recent Windows 10 on a best-effort basis. The README’s Windows install, run in PowerShell:

powershell -ExecutionPolicy ByPass -c "irm https://chatgpt.com/codex/install.ps1 | iex"
Copied

Then open a new PowerShell window, since the installer adds its folder to your user PATH for windows opened afterwards. npm install -g @openai/codex works on Windows too. If your code lives in Linux, install Codex inside WSL2 with the Linux script instead; WSL1 is not supported. The sandbox setup prompt on first run, MXC, the execution-policy error and where the files go are in Codex on Windows.

First run and sign-in

cd ~/your-project
codex
Copied

On the first run, OpenAI’s docs say to “choose Sign in with ChatGPT or another available sign-in method.” The authentication page sets out the two kinds: ChatGPT sign-in “for subscription access”, using your plan’s Codex allowance (which plans include it is in a guide of its own), and an API key “for usage-based access”, billed at API rates.

The sign-in is saved in ~/.codex/auth.json, a plaintext file with live tokens, unless you set Codex to use the system’s credential store. codex login status shows which method is active, and codex logout clears it.

Linux: the sandbox wants bubblewrap

Codex runs the commands it chooses inside a sandbox, which on Linux is bubblewrap. It prefers the first bwrap on your PATH and falls back to a copy it bundles, with a startup warning, so install your distribution’s bubblewrap package. On Ubuntu 24.04 it also needs an AppArmor profile before it can create user namespaces, or every sandboxed command fails; the bubblewrap errors guide has each warning and its fix, and Codex on a Linux server walks a whole headless install.

Check it, and fix “codex: command not found”

codex --version      # the installed version, 0.172.0 if it is the latest
command -v codex     # which file runs (Get-Command codex in PowerShell)
type -a codex        # every codex on the PATH, if there is more than one
Copied

If the shell cannot find codex, the cause is nearly always the PATH:

# the current terminal, after the install script
export PATH="$HOME/.local/bin:$PATH"
Copied

If codex --version prints an old number, a second copy is earlier on the PATH, typically an npm install beside a script install. type -a codex lists them; keep one and remove the others with their own uninstall. From then on, codex update runs the right update for the install script, npm or Homebrew on a Mac, and the update guide covers it when it fails.

Run Codex on an always-on developer pod.

A developer pod is a permanent cloud computer (VPS), set up and secured for you, with your pick of Claude Code, Codex, OpenCode, Pi, Hermes and OpenClaw installed. Run more agents at once than your laptop can hold, and keep them working when it’s closed. From $24 a month, built in about ten minutes.