“command not found: codex” after installing Codex
Codex CLI install — your shell's message, not a Codex error. The one openai/codex issue found with this exact text in its title is a user report, so what this page says about that report is a user's experience, not OpenAI guidance; the install steps come from the official docs and installer.
The message
“zsh: command not found: codex”
What it means
The shell is saying it cannot find a program called codex in the places it looks for commands. The “zsh:” at the front is the shell speaking, and neither the docs nor Codex's source has an entry for it. The one issue on the openai/codex tracker with this exact text in its title (#15, from 2025, closed) was from someone who had installed with yarn. The reporter wrote that the cause was a missing npm path in their .zshrc, and a second user who uses asdf wrote that installing with bun worked for them. Those are two users' experiences, and the docs do not cover that case.
What you can do
- Install with one of the documented commands. For macOS and Linux that is
curl -fsSL https://chatgpt.com/codex/install.sh | sh; the installer script putscodexin~/.local/binby default and adds that folder to your PATH through a shell profile. - Right after installing, the installer prints how to launch Codex. Its “Future terminals” line says to “open a new terminal and run: codex”, and for the terminal you are in it prints a “Current terminal” line with an export PATH command. A terminal that was already open before the install won't see the change until you do one of those.
- To check from the shell, the official WSL page gives
which codex || echo "codex not found", and says that if the binary isn't found you should follow the Codex CLI setup instructions again. That page is about WSL, but the check itself is a plain shell command. - On Windows the docs say to start the PowerShell installer from a new PowerShell window. On WSL, run the Linux installer inside the WSL shell, not in Windows PowerShell.
- If you installed with npm or another package manager and then hit this, the user report above is an example of a PATH problem, but Codex's docs don't describe it. The full install commands for Mac, Linux, Windows and WSL are on /install/.
On this site: install Codex CLI · check your Codex usage · did Codex reset today? · OpenAI status
Also searched as
People look this message up in several ways. These are search wordings, not OpenAI's text:
- command not found: codex
That is the same text without the shell name. No other wording was checked against a source, so none is listed.
Sources
- openai/codex issue #15 (a user report, closed) — fetched 2026-11-09
- openai/codex source: scripts/install/install.sh (install folder and PATH messages) — fetched 2026-11-09
- Codex docs: Codex on WSL (PATH check) — fetched 2026-11-09
- Codex docs: Codex CLI (install commands) — fetched 2026-11-09
This site is not affiliated with OpenAI. Where a statement above comes from a user report or a reply on the openai/codex issue tracker rather than documentation, it says so.
Frequently asked questions
How do I fix “command not found: codex” after installing Codex?
Open a new terminal, or run the export PATH line the installer printed. The installer puts codex in ~/.local/bin by default and adds that folder to PATH through a shell profile, which a terminal opened before the install won't have picked up. To check, the WSL docs use: which codex || echo "codex not found".
Is “command not found: codex” a Codex bug?
It is printed by your shell, not by Codex, and no official page or source file has an entry for it. The one openai/codex issue with that text in its title was a user report about an npm-style install, where the user said a missing path in .zshrc was the cause.
Why does Codex say command not found on Mac but work in another terminal?
No official source answers this. The documented behaviour that fits is that the installer adds the install folder to PATH through a shell profile and tells you to open a new terminal, so a terminal started earlier, or one that does not load that profile, won't find codex. That is an inference from the installer's behaviour, not a documented diagnosis.