Skip to content

Codex CLI · Guide

How to install and update Codex CLI

Every command on this page is copied from the official OpenAI documentation, listed at the end, and checked on 18 October 2026.

Quick answer: On macOS or Linux run curl -fsSL https://chatgpt.com/codex/install.sh | sh. On Windows run powershell -ExecutionPolicy ByPass -c "irm https://chatgpt.com/codex/install.ps1 | iex" in PowerShell. On any system you can also use npm install -g @openai/codex. Then run codex and choose Sign in with ChatGPT. The latest stable version is 0.163.0, released 15 October 2026.

Install on macOS or Linux

OpenAI's standalone installer is the first option in its docs. It installs to ~/.local/bin by default:

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

Install with Homebrew

brew install --cask codex

Install on Windows

Open a new PowerShell window and run the standalone installer. It adds Codex to your user PATH:

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

OpenAI recommends the native Windows sandbox by default and WSL when you need Linux-native tooling or already work in WSL2. Windows 11 is recommended; a recent, fully updated Windows 10 (version 1809 or newer) is best effort.

Install in WSL2

From an elevated PowerShell or Windows Terminal, install and open WSL, then run the Linux installer inside it (WSL1 is no longer supported since Codex 0.115):

PowerShell

wsl --install
wsl

Inside WSL

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

Install with npm (any system)

The npm package ships the native binary for macOS, Linux and Windows (x64 and ARM64). Its package.json asks for Node.js 16 or later:

npm install -g @openai/codex

Sign in

Run codex and choose Sign in with ChatGPT, or run codex login and finish in the browser. Usage then counts against your ChatGPT plan's limits.

To pay per use with an API key instead (some cloud features are then unavailable):

printenv OPENAI_API_KEY | codex login --with-api-key

Headless machine or SSH (beta, enable device codes in ChatGPT first)

codex login --device-auth

Check or clear the login

codex login status
codex logout

Check your version

codex --version

Inside a session, /status shows your configuration and usage limits.

Update Codex CLI

Codex checks for a new version when it starts and offers to update. To update yourself, use the built-in command or the same method you installed with:

Built-in

codex update

Standalone installer (macOS, Linux)

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

Standalone installer (Windows)

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

npm

npm install -g @openai/codex

Homebrew

brew upgrade --cask codex

Install a specific version

Pin a version with npm, here the latest stable one:

npm install -g @openai/codex@0.163.0

Requirements

macOS 12 or later; Ubuntu 20.04+ or Debian 10+; Windows 11 (or a recent Windows 10, best effort) natively or through WSL2. At least 4 GB of RAM (8 GB recommended). Git 2.23+ is optional but recommended.

On Linux, install bubblewrap for the sandbox:

sudo apt install bubblewrap

Troubleshooting

Run the built-in diagnostics first:

codex doctor

Sign-in fails over SSH or on a headless machine: use codex login --device-auth, or forward the callback port with ssh -L 1455:localhost:1455 and run codex login there.

The wrong version starts on Windows: run Get-Command codex to find a competing npm or standalone install.

Questions

How do I install Codex CLI on Windows?
Open a new PowerShell window and run powershell -ExecutionPolicy ByPass -c "irm https://chatgpt.com/codex/install.ps1 | iex". You can also use npm install -g @openai/codex, or install it inside WSL2 with the Linux installer.
How do I update Codex CLI?
Run codex update, or repeat your install method: the standalone installer, npm install -g @openai/codex, or brew upgrade --cask codex for Homebrew.
How do I check my Codex CLI version?
Run codex --version in a terminal.
Is Codex CLI free?
The CLI itself is open source. Using it needs a ChatGPT plan or an API key: OpenAI's pricing page lists the CLI from ChatGPT Plus (also Pro, Business, Edu and Enterprise), and an API key is billed per use. OpenAI's help center says Codex is included across plans including Free and Go, so check the pricing page for your plan.

Sources

  1. Codex CLI (OpenAI docs)
  2. Authentication (OpenAI docs)
  3. openai/codex README
  4. Install and build (openai/codex)
  5. Windows sandbox (OpenAI docs)
  6. WSL (OpenAI docs)
  7. CLI commands (OpenAI docs)
  8. Troubleshooting (OpenAI docs)
  9. Pricing (OpenAI docs)

Computer mode

Prefer a retro PC?

Boot the Retro AI Tracker 98 desktop: every section as a window, a Games folder, the Start menu and a taskbar. The website stays the default.

Boot computer mode