Coding Agents & Terminal · recorded 2026-08-30 · applies to 1 tool(s) ✓ Verified

Problem: ChatGPT Windows client won't open: Unable to locate the Codex CLI binary / Codex CLI not found —— Trove problem library

Verified 2026-08-30ChatGPT client cannot locate the Codex CLI — run `codex --version` first; if missing, install via the official PowerShell script, then set CODEX_CLI_PATH to the real path (don't copy paths from the web).

Quick fix

# 1. Check whether it is installed (a version string means yes)
codex --version

# 2. Not installed: official PowerShell installer (needs access to chatgpt.com)
powershell -ExecutionPolicy ByPass -c "irm https://chatgpt.com/codex/install.ps1 | iex"

# 3. Set CODEX_CLI_PATH to the real path (do not copy someone else's full path)
where codex
setx CODEX_CLI_PATH "<full path from where codex>"

# 4. Fully quit the ChatGPT client (not minimize) and reopen

What you will run into

After updating the ChatGPT Windows client it stops opening, showing:

ChatGPT failed to start.
Unable to locate the Codex CLI binary.
Set CODEX_CLI_PATH or ensure the client resources include bin/codex.

You opened ChatGPT but it complains about Codex CLI - the new ChatGPT client depends on the Codex CLI binary at startup.

Why this happens

At startup the client locates the codex binary: first PATH, then the CODEX_CLI_PATH target; if neither exists it refuses to start. Three common cases:

CaseNotes
Codex CLI not installedcodex --version says 'not recognized as an internal or external command'
Installed but not on PATHPATH not refreshed after install / PATH modified
CODEX_CLI_PATH points to the wrong placewrong variable name, or copied path from another machine (install layouts differ)

The client locates the CLI binary with two-level addressing: "PATH first, env-var override second" — it searches PATH for a binary named codex, and if not found, checks the path pointed to by CODEX_CLI_PATH; only when both fail does it refuse to start.

This order gives the three failure modes different semantics: not in PATH = not installed or PATH not refreshed; in PATH but CODEX_CLI_PATH pointing wrong = the variable overrode correct addressing (the variable wins over PATH, and a bad target fails everything);

wrong variable name = as if unset, falling back to PATH.

Deterministic takeaway: on "codex not found", first verify the binary directly with codex --version, then check echo $CODEX_CLI_PATH for leftovers;

before hard-coding a path in config, confirm which codex matches this machine's layout (never copy someone else's path); fix order: install/refresh PATH for ①②, unset CODEX_CLI_PATH or correct the path for ③.

Step by step

1. Check whether Codex CLI exists — Required

codex --version

'codex' not recognized -> not installed or missing from PATH, go to step 2; a version string -> installed, go to step 3.

2. Install Codex CLI — Required

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

Confirm with codex --version afterwards.

3. Configure CODEX_CLI_PATH (use the actual local path) — Required

where codex
setx CODEX_CLI_PATH "C:\Users\<your user>\...\codex.exe"   # use the where codex output

Do not copy a path: layouts differ across machines/installers (the article's default is %LOCALAPPDATA%\Programs\OpenAI\Codex\bin\codex.exe; locally measured %LOCALAPPDATA%\OpenAI\Codex\bin\<hash>\codex.exe).

The variable name must be exactly CODEX_CLI_PATH.

4. Reopen the client — Required

Environment variables only affect new processes: fully quit the ChatGPT client (no leftover process in Task Manager) before starting it again.

How to confirm it works

codex --version returns a version; the ChatGPT client opens normally and no longer shows Unable to locate the Codex CLI binary.

Other environments

EnvironmentNotes
codex on PATH, CODEX_CLI_PATH unsetclient works fine (locally verified: 0.151.0-alpha.7.1 on PATH, CODEX_CLI_PATH unset, client starts) - PATH is enough, CODEX_CLI_PATH is an explicit fallback
Installer scripthttps://chatgpt.com/codex/install.ps1 times out on campus network (http=000), needs proxy/network window, not verified locally
Not verifiedthe full 'client won't open' scenario was not reproduced locally (client works here); fix steps come from the source article

Symptom

ChatGPT Windows client won't open: ChatGPT failed to start. Unable to locate the Codex CLI binary. Set CODEX_CLI_PATH or ensure the client resources include bin/codex.; codex --version may say 'not recognized'.

Cause

The new ChatGPT client depends on the Codex CLI binary at startup: codex is missing from PATH and CODEX_CLI_PATH is unset or wrong -> the client refuses to start.

Solution

  1. codex --version to check installation;
  2. Not installed -> official installer: powershell -ExecutionPolicy ByPass -c "irm https://chatgpt.com/codex/install.ps1 | iex";
  3. where codex for the real path, then setx CODEX_CLI_PATH "<real path>" (exact variable name, no copied paths);
  4. Fully quit the client (not minimize) and reopen.
Verification Evidence
  • Local check (2026-08-30, Windows 11): codex-cli 0.151.0-alpha.7.1 on PATH (where codex -> %LOCALAPPDATA%\OpenAI\Codex\bin\<hash>\codex.exe), CODEX_CLI_PATH unset yet the client starts normally -> PATH alone satisfies the client, CODEX_CLI_PATH is an explicit fallback; the actual install layout differs from the article's default path (trust where codex). local repro log 2026-08-30.
  • Not verified: the installer script (chatgpt.com times out on campus network, http=000, needs proxy); the full 'client won't open' scenario (not reproduced locally; steps from the source article).

Applicable tools (1)

This problem is linked from the tool pages below — reachable from either side.

codex

Source & evidence

Recorded Verified ✓ VerifiedApplies to 1 tool(s)
Entries contain locally measured or reviewable-source solutions; unmeasured items are explicitly labeled.

Source: https://blog.51cto.com/kaigejava/14886935

← Coding Agents & Terminal domain | Problem Catalog Experience | Facing another issue? Go to the Helpdesk