Fix "codex: command not found"

"Command not found" after installing Codex almost always means your terminal can't see the install location yet. Open a new terminal window first. If that doesn't help, find where Codex was installed: the npm global bin folder, Homebrew's bin, or the installer's location. Make sure that folder is on your PATH, then run codex --version.

The error message
zsh: command not found: codex

Applies to: Codex CLI, macOS, Linux, Windows

1. Open a new terminal

Installers change your PATH, but already-open terminals don’t pick that up. Close the window, open a new one, and run:

codex --version

2. Find where Codex went

Installed withCheck
npmnpm prefix -g. The binary is in its bin folder on macOS/Linux, or in the prefix folder itself on Windows.
Homebrewbrew --prefix, then look in its bin folder
Standalone installerRe-run the installer and read its final output for the install location

3. Add that folder to your PATH

macOS / Linux (zsh shown; use ~/.bashrc for bash):

echo 'export PATH="/path/to/that/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc

Windows: open Edit environment variables for your account, select Path, then Edit, add the folder, and open a new PowerShell window.

4. Still nothing?

Reinstall with a single method. Mixing npm, Homebrew, and the standalone installer can leave broken or duplicate copies. See Install the Codex CLI.

Questions people ask

On Windows it says 'codex' is not recognized. Same fix?

Yes. Close and reopen PowerShell first. If you installed with npm, run npm prefix -g and make sure that folder is in your user PATH under Environment Variables.

I have two versions. Which one runs?

The first one found on your PATH. List them all with which -a codex on macOS/Linux or where.exe codex on Windows, and remove the one you don't want.

Sources

We link to the official source for every instruction on this page. If anything here disagrees with them, trust the official source and tell us.