Codex CLI installs in three ways: with the installer script, through npm, or through Homebrew (Mac only). On Windows there is a native installer you run from PowerShell, no WSL needed. Below are the exact commands for each system and a rundown of the errors that show up most often right after installation.
Install on Mac and Linux
OpenAI recommends the installer script by default, and you run it through curl.
curl -fsSL https://chatgpt.com/codex/install.sh | sh
The script detects the CPU architecture itself (Apple Silicon and x86_64 on Mac, x86_64 and arm64 on Linux) and puts the matching binary in place. Updating uses the same script: run it again and it pulls the latest version over the old one.
With Homebrew (Mac only)
If your packages already live in Homebrew, there is a separate formula:
brew install --cask codex
With npm (Mac, Linux, Windows)
Codex CLI also ships as an npm package. That is handy when Node.js is already installed and you want to keep your tools in one manager:
npm install -g @openai/codex
This method needs Node.js. The documentation does not name a version, but the current LTS branch works without trouble. If npm install fails with a syntax error or an unknown flag, the Node version is most likely too old.
Install on Windows
The native route without WSL comes down to a single PowerShell command.
powershell -ExecutionPolicy ByPass -c "irm https://chatgpt.com/codex/install.ps1 | iex"
The -ExecutionPolicy ByPass flag is there because Windows blocks unsigned scripts from the internet by default. Without it the command stops on an execution-policy error, even though the downloaded file is fine.
The same npm package works on Windows when Node.js is already installed:
npm install -g @openai/codex
Whichever method you pick, Codex CLI is available afterwards from a regular PowerShell window and from the terminal inside VS Code. You do not need to set up PATH, because the installer does it.
Downloading the binary directly
CI, containers and any other place where you would rather not pull a script from the internet can use the ready-made archives in the Codex releases on GitHub. There are separate builds for Apple Silicon and Intel Mac, and for Linux x86_64 and arm64. The binary is the same one the official script installs, only without the automation: you unpack the archive and add it to PATH by hand.
Codex app and IDE extensions
The codex app command launches the ChatGPT app for macOS and Windows (Codex CLI command reference). There is no separate Codex app any more: according to OpenAI, on July 9, 2026 Codex app was merged into the ChatGPT desktop app and stays there as its own coding section next to Chat and Work (What's new). That is why recent guides call it the ChatGPT desktop app, and the old name Codex app now turns up mostly in release names.
cd /path/to/your/project
codex app
Besides the CLI there are editor extensions (VS Code, Cursor, Windsurf) and a web version of Codex on chatgpt.com. These are different ways into the same product, not different versions of Codex.
After installation: your own API key instead of a subscription
Out of the box Codex CLI asks you to sign in with a ChatGPT account. It can also sign in with an API key, with no tie to a subscription: you then define a separate provider in ~/.codex/config.toml (on Windows that is %USERPROFILE%\.codex\config.toml).
With codexkey the same config connects GPT-5.6 models, paid in rubles, with no ChatGPT subscription and no OpenAI account sign-in:
model_provider = "codexkey"
model_reasoning_effort = "medium"
model = "gpt-5.6-sol"
[model_providers.codexkey]
name = "codexkey"
base_url = "https://api.codexkey.online/v1"
env_key = "CODEX_KEY"
Set the key variable in the system before you start Codex:
# PowerShell: add to your profile or set before launching
$env:CODEX_KEY = "your-codexkey-key"
# bash/zsh: add to ~/.bashrc or ~/.zshrc
export CODEX_KEY="your-codexkey-key"
A step-by-step walkthrough for all three systems, including how to create the .codex folder on Windows with PowerShell, is in the Codex guide. Signing in with an API key and no subscription at all, with a choice between sol, terra and luna for a given task, is described in Codex CLI with an API key instead of a subscription.
Common errors after installation
"command not found: codex" after installing
Usually the terminal simply has not seen the new binary in the PATH of the current session. Close the terminal and open it again. On macOS and Linux you can instead run source ~/.zshrc (or source ~/.bashrc).
Execution policy error in PowerShell
Without the -ExecutionPolicy ByPass flag, Windows refuses to run a script from the internet. Use the installation command in full, as shown above, and not just the link to install.ps1.
npm install fails with a permissions error
On Linux and Mac a global package install sometimes needs sudo npm install -g @openai/codex. That happens when Node.js came from a system package manager without a per-user prefix. It is safer to configure npm once to put global packages in your home directory than to treat the symptom with sudo every time.
Codex starts but asks to sign in to ChatGPT, although you only need an API key
It means config.toml was not picked up, or the key variable is not exported in the current session. Check that the file sits at the path that is right for your OS, and that the variable named in env_key is set in the same shell you launch codex from.
FAQ
How do I download Codex on a Windows PC without WSL?
With a PowerShell command: powershell -ExecutionPolicy ByPass -c "irm https://chatgpt.com/codex/install.ps1 | iex". WSL is not needed, and the installation is native.
Are Codex CLI and codex app the same thing?
No. Codex CLI is a terminal agent. The app for macOS and Windows is called the ChatGPT desktop app, and since July 9, 2026 Codex has been a separate coding section in it. The codex app command in the CLI launches that app.
What should I do if Codex shows an error on first launch?
If you installed through npm, check the Node.js version first and make sure PATH has refreshed in the current terminal. When the error is about authentication, see whether ~/.codex/config.toml exists and what the key environment variable holds.
Do the ChatGPT desktop app and Codex CLI need separate installers?
Yes, the installers are different. ChatGPT desktop installs as an app for macOS or Windows, and Codex has been built into it since July 9, 2026. Codex CLI installs with its own script or through npm/Homebrew, as described above.
Can I install Codex CLI offline, from a local file?
Yes, from a ready-made archive on GitHub Releases: download it in advance on another machine, copy it over and unpack it by hand, then add the binary's path to PATH.