To install the Codex CLI with npm, run npm install -g @openai/codex, then run codex in a project folder and sign in. OpenAI also documents a standalone installer for macOS, Linux and Windows, a Homebrew cask, and prebuilt binaries on GitHub, none of which need Node.js.
This guide covers every documented install method by operating system, how to verify the install, how to update and pin versions, and how to uninstall. Facts come from OpenAI's Codex CLI page, the openai/codex README and the environment variables page, read on 26 October 2026, when the latest release on GitHub was 0.164.0 (published 23 October 2026).
Which install method should you use?
OpenAI documents five ways to get the CLI:
| Method | Command | OS | Needs Node.js |
|---|---|---|---|
| Standalone installer | curl -fsSL https://chatgpt.com/codex/install.sh | sh |
macOS, Linux | No |
| Standalone installer | powershell -ExecutionPolicy ByPass -c "irm https://chatgpt.com/codex/install.ps1 | iex" |
Windows | No |
| npm | npm install -g @openai/codex |
Any with Node.js | Yes |
| Homebrew | brew install --cask codex |
macOS | No |
| GitHub Release binary | Download from the latest release | macOS, Linux, Windows | No |
The Codex CLI page lists the standalone installer first. Pick npm if you already manage tools through Node.js, Homebrew if that is how you keep your Mac up to date, and a binary if you need a fixed file you can copy around.
Pick one. OpenAI's installer script warns that "Multiple managed Codex installs can be ambiguous because PATH order decides which one runs."
How do you install Codex with npm?
Run:
npm install -g @openai/codex
Use the scoped name @openai/codex, the one OpenAI documents. The package.json for that package in OpenAI's repo declares "node": ">=16" in its engines field.
To install a specific version, add it after @, as OpenAI's Windows deployment guide does:
npm install -g @openai/codex@0.164.0
If a global npm install fails on permissions, the standalone installer is an alternative: it installs into your user folder by default. On Windows, the deployment guide adds a useful warning: "Global" in npm "does not necessarily mean all Windows users."
How do you install Codex on macOS and Linux?
The standalone installer is one line:
curl -fsSL https://chatgpt.com/codex/install.sh | sh
Facts about it from OpenAI's docs and the installer source on GitHub:
- It puts the visible
codexcommand in~/.local/binby default. SetCODEX_INSTALL_DIRto change that. - It keeps its package cache under
CODEX_HOME/packages/standalone, which is~/.codex/packages/standaloneby default. - It downloads from
https://releases.openai.com/codexand falls back to GitHub Releases if a download is unavailable. SetCODEX_INSTALLER_USE_RELEASES_OPENAI_COM=falseto force GitHub. - It verifies the download against a SHA-256 checksum before installing.
- It accepts
--release VERSIONorCODEX_RELEASEto pin a version, andCODEX_NON_INTERACTIVE=1to skip prompts in scripts.
# Unattended install, for example in a provisioning script
curl -fsSL https://chatgpt.com/codex/install.sh | CODEX_NON_INTERACTIVE=1 sh
On a Mac with Homebrew, the cask is the alternative:
brew install --cask codex
The repo's install doc lists system requirements of macOS 12+ or Ubuntu 20.04+/Debian 10+, 4 GB of RAM minimum (8 GB recommended), and optionally Git 2.23+ for built-in PR helpers.
How do you install Codex on Windows?
Open a new PowerShell window and run:
powershell -ExecutionPolicy ByPass -c "irm https://chatgpt.com/codex/install.ps1 | iex"
That is the README's form. The Codex CLI page shows the shorter irm https://chatgpt.com/codex/install.ps1 | iex, run from a new PowerShell window. The installer puts the command in %LOCALAPPDATA%\Programs\OpenAI\Codex\bin and adds it to your User PATH, so open a new terminal afterwards. npm works on Windows too if Node.js is already installed. For a pinned version, the deployment guide downloads the script and passes -Release:
$CodexRelease = '0.164.0'
Invoke-WebRequest -UseBasicParsing -Uri 'https://chatgpt.com/codex/install.ps1' -OutFile '.\codex-install.ps1'
powershell -ExecutionPolicy Bypass -File .\codex-install.ps1 -Release $CodexRelease
Note that the repo's install doc still lists "Windows 11 via WSL2" in its requirements table, while the Codex CLI page now documents the native PowerShell installer above. If you prefer Linux tooling, install inside WSL2 with the macOS and Linux command. OpenAI's WSL page says WSL1 was supported through Codex 0.114 and is no longer supported from 0.115.
Can you install Codex from a GitHub binary?
Yes. Each GitHub Release contains many files. The README points to these for most people:
| Platform | File |
|---|---|
| macOS Apple Silicon | codex-aarch64-apple-darwin.tar.gz |
| macOS Intel | codex-x86_64-apple-darwin.tar.gz |
| Linux x86_64 | codex-x86_64-unknown-linux-musl.tar.gz |
| Linux arm64 | codex-aarch64-unknown-linux-musl.tar.gz |
Each archive holds one executable with the platform in its name, so rename it to codex and put it on your PATH. Releases also include a DotSlash file named codex, which lets a team commit a lightweight pointer so everyone runs the same version. Building from source with Cargo is covered in the repo's install doc.
How do you verify the install and sign in?
Open a new terminal, then:
codex --version
codex
On Windows, OpenAI's deployment guide also runs Get-Command codex to confirm which executable resolves. The first time you run codex, choose Sign in with ChatGPT or another available method. The README notes that an API key also works but "requires additional setup."
If anything is off, run codex doctor. The CLI reference says it generates "a local diagnostic report" that checks "installation, configuration, authentication, runtime, Git, terminal, app-server, and thread inventory health." Our Codex troubleshooting guide covers common errors such as command not found.
How do you update Codex?
Update with the same method you installed with:
| Installed with | Update command |
|---|---|
| Standalone installer | Rerun the same install.sh or install.ps1 command |
| npm | npm install -g @openai/codex |
| Homebrew | brew upgrade --cask codex |
There is also a built-in command. The CLI reference describes codex update as: "Check for and apply a Codex CLI update when the installed release supports self-update." OpenAI's troubleshooting page notes that the ChatGPT desktop app and Codex CLI "can include different Codex versions," so a feature may reach one before the other.
How do you uninstall Codex?
OpenAI's docs don't publish a dedicated uninstall page. The commands below are taken from its installer script on GitHub, which runs them when it finds an existing npm, Bun or Homebrew install and you agree to remove it before a standalone install:
npm uninstall -g @openai/codex # npm
brew uninstall --cask codex # Homebrew
bun remove -g @openai/codex # Bun
For the standalone installer, OpenAI documents no removal steps. Based on the installer's default paths (our inference, not an official procedure), delete the codex command from its install folder (~/.local/bin by default, or %LOCALAPPDATA%\Programs\OpenAI\Codex\bin on Windows), along with a codex-code-mode-host link there if one exists, and the package cache under ~/.codex/packages/standalone. On Windows, also remove that folder from your User PATH.
Be careful with the rest of ~/.codex. The environment variables page describes CODEX_HOME as "the root for Codex state, including config, auth, logs, sessions, skills, and standalone package metadata." Deleting the whole folder removes your settings, saved sign-in and chat history too, so only do it if you want a clean slate.
What should you set up after installing?
Three things make the first week smoother: a ~/.codex/config.toml with your preferred model and approval mode (see the Codex config.toml guide), an AGENTS.md in each repo, and the skills you rely on. Kipt keeps prompts and Agent Skills as Markdown in a private GitHub repo you own, and one command, npx skills add https://github.com/<you>/<repo>.git --all -g, installs every skill into Codex on a fresh machine. The Codex CLI guide covers flags, commands and your first session.