Install Codex CLI

Install Codex CLI on macOS, Windows, and Linux, then verify the install before configuring HopsAPI.

Codex CLI ships a standalone installer that bundles its own runtime, so Node.js is optional.

System requirements

ItemRequirementNotes
macOS12 (Monterey) or laterApple Silicon and Intel both supported
Windows10 / 11Native support is experimental; WSL2 is the more tested path
Linuxglibc-based distros (Ubuntu 22.04+, Debian 11+, Fedora 34+)—
Node.js22 or later, recommendedOnly relevant to the npm install

macOS

Run this in the terminal:

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

Homebrew works too:

brew install --cask codex

Windows

Run this in PowerShell:

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

If your execution policy blocks the script, use the npm route below instead.

Codex reads and writes Git repositories, so install Git for Windows — it also provides Git Bash, which avoids most path quirks of the native shell. Native Windows support is still experimental; if problems persist, install inside WSL2 and follow the Linux steps.

Linux

Run this in the terminal:

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

Install with npm

If you already have a stable Node.js setup, or the standalone installer is blocked on your machine, npm is the officially supported alternative:

npm install -g @openai/codex

It needs Node.js 22 or later. Install it through nvm to avoid sudo and permission errors:

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash
nvm install 22
npm install -g @openai/codex

On Windows, install Node.js from nodejs.org instead. Don't use sudo npm install -g — it leads to permission and security problems.

Verify the install

Run this in the terminal:

codex --version

A version number means the install succeeded. If the shell reports command not found, open a new terminal — the installer updates PATH, but sessions started earlier keep the old value.

Codex still talks to OpenAI at this point. Continue with Configure a model provider to route it through HopsAPI.

Troubleshooting

SymptomFix
codex: command not found right after installingOpen a new terminal. The installer updates PATH, but earlier sessions keep the old value.
EACCES or another permission error during npm install -gFix your npm global prefix, or install Node.js through nvm. Avoid sudo npm install -g.
node --version reports below 22Run nvm install 22 && nvm use 22, or switch to the standalone installer, which bundles its own runtime.
PowerShell refuses to run the install scriptInclude -ExecutionPolicy ByPass exactly as shown, or install through npm.
Download fails or stallsForce the GitHub Releases mirror: curl -fsSL https://chatgpt.com/codex/install.sh | CODEX_INSTALLER_USE_RELEASES_OPENAI_COM=false sh
On this page

On this page