Unable to Locate Codex CLI Binary on Windows
This error means Windows can’t find the `codex` executable where your terminal expects it. The fix is usually to confirm that `codex.exe` actually exists, then put its folder on `PATH` and make sure Windows isn’t hiding or blocking it. If the file is missing or the install looks broken, a clean reinstall from a fresh shell is usually the fastest safe path.
What this error usually means on Windows
On Windows, “unable to locate Codex CLI binary” usually means one of three things: the CLI was never installed, it was installed somewhere your shell doesn’t search, or a stale PATH entry points to the wrong place. A related problem is Windows finding a different codex-named command before the one you meant to use.
The symptom can show up in a terminal, an installer, or another tool that tries to launch Codex CLI for you. In all cases, the message means the launcher tried to resolve an executable name and failed. That failure is about discovery, not necessarily about Codex itself being broken.
When this fix applies and when it doesn’t
Use these steps if you just installed Codex CLI, updated it, moved files around, or started getting the error after a shell restart. This also applies if codex worked before and now says it can’t be found.
This article applies to Windows installs of Codex CLI, including cases where the installer, PowerShell, or Command Prompt says it cannot locate the binary.
You do not need admin rights for the first checks. You may need Administrator access only if you are editing machine-level environment variables or reinstalling into a protected folder.
Before changing anything, do two safe checks first:
- Open a new terminal window instead of reusing the old one.
- Check whether the command is missing in both PowerShell and Command Prompt.
If you are dealing with a different Codex-related tool, or if the error mentions a package manager rather than the binary itself, the fix may be different.
Check whether the binary is actually on your machine
Start by proving whether the executable exists. If the file is not there, PATH changes won’t help.
- Find the folder where you expected Codex CLI to be installed. Check common locations such as your user profile, a package manager folder, or the directory shown by the installer.
- Open File Explorer and look for the executable name, often
codex.exeon Windows. - If you prefer the terminal, check what Windows can resolve.
Get-Command codexwhere codexIf either command prints a path, Windows can see a codex executable somewhere. If both fail, either the file is missing or the folder containing it is not on PATH.
If the executable exists in File Explorer but the terminal cannot find it, the install is probably fine and the path is the problem. If the file is not there at all, skip ahead to the clean reinstall section.
Add the Codex CLI folder to PATH the right way
If the binary exists, add the folder that contains it to your user PATH. You want the directory, not the .exe file itself.
- Copy the full folder path that contains
codex.exe. - Open Windows Environment Variables.
- Edit the user
Pathvariable and add the folder. - Save the changes and close every terminal window.
- Open a fresh terminal and test again.
System Properties > Advanced > Environment Variables > User variables for <your user> > PathIf you installed the binary under a user profile folder, the user Path is usually enough. If the tool was installed for all users and you have admin rights, you can also add it to the system Path, but the user Path is safer and easier to undo.
If the command still fails after adding the folder, check for a typo in the path, confirm you added the folder that actually contains the executable, and make sure the terminal was fully reopened. Windows only reads updated environment variables in new processes.
Watch for Windows quirks that hide the binary
A few Windows-specific issues can make a valid install look missing.
Microsoft Store app execution aliases can interfere if Windows routes a command name to a Store stub instead of your real binary. Open the App execution aliases settings and turn off anything that conflicts with the command name you are using.
Settings > Apps > Advanced app settings > App execution aliasesPowerShell execution policy is less likely to hide a native .exe, but it can block scripts or wrapper files used by an installer. If your install created a .ps1 shim or a launcher script instead of a direct .exe, that wrapper may be blocked even when the binary exists.
Antivirus can quarantine new executables without much warning. If the file was present and then vanished, check the protection history or quarantine view in your security software.
Symlinks and junctions can also cause trouble if the installer placed the binary through a redirected path that no longer exists. In that case, the path may look valid but resolve to nowhere. Fix the underlying folder target or reinstall into a normal local directory.
Reinstall cleanly if the install looks broken
If the file is missing, partially installed, or still not found after the path checks, a clean reinstall is often the quickest fix.
Before removing anything, note the install location and save any config or auth files you want to keep.
- Remove the old Codex CLI entry using the same method you used to install it, if that method provides an uninstall step.
- Delete stale
PATHentries that point to old Codex folders. - Open a fresh terminal, then reinstall from the same package source or installer you trust.
- Confirm the installer places the binary in a real folder you can browse to in File Explorer.
If the old installation left behind a broken wrapper, cleanup matters. Otherwise Windows may keep finding the stale reference instead of the new binary. If you reinstall without removing the broken path entry, you can end up with the same error again even though the file now exists elsewhere.
If the binary exists but the app still cannot locate it, check for leftover environment variable entries beyond PATH, such as old install locations in launcher settings or shell profiles. Remove the stale references, close every terminal, and reinstall from that clean shell so the new process picks up the corrected environment.
Confirm the fix from a fresh terminal
The fix is only real if a brand-new shell can run the command directly.
- Close every open Command Prompt or PowerShell window.
- Open a new PowerShell window.
- Run the command by name.
codex --versionIf the install is correct, you should see version output instead of a missing-command error. If that works, try the same check in Command Prompt too, because different shells can pick up different startup state.
- If you want to verify the exact executable location, ask Windows again.
Get-Command codexA valid path in the output means the shell can resolve the binary. If the version command works only when you type the full path, the install exists but PATH still needs attention. If it fails only in one shell, that shell may be loading old environment variables or a conflicting profile setting.
How to avoid the same problem next time
Use one install method and one install location, then keep that path stable. Mixing a package manager install, a manual unzip, and a Store alias is how Windows ends up with conflicting commands.
After updates, reopen your terminal before testing. Old shells keep old environment variables, which makes it look like an update failed when the new process just has not started yet.
If you manage PATH often, keep it short and remove dead entries. Windows has a practical limit, and a bloated PATH makes it easier for the wrong command to win resolution.
If antivirus has already quarantined a tool once, add the install folder to whatever allowlist your security setup uses, if that fits your policies.
Quick answers to the usual follow-up questions
PowerShell and Command Prompt usually behave a little differently, but the core issue is the same: if the binary is on PATH, both should be able to find it. If one shell works and the other does not, the problem is often a startup profile, an alias, or a stale session rather than the install itself.
You usually do not need Administrator rights just to run the CLI from your own account. Admin rights matter more when you install into a protected location or edit system-wide environment variables.
If where codex finds nothing after install, it usually means one of these: the folder is not on PATH, the executable name is different from what you typed, or Windows is picking up a conflicting alias or stub first.
If the binary exists but the app still cannot locate it, clean out old environment variable entries, close every terminal, and reinstall from that clean shell. That clears the stale process state that most often causes this error to stick around.
Conclusion
If you only do two things, do these: confirm `codex.exe` exists in a real folder, then test it from a brand-new terminal after adding that folder to `PATH`. If the file is missing or the install looks half-finished, remove the stale entry and reinstall cleanly from a fresh shell. Once `codex --version` works, the binary is truly available and the error should stop.
Frequently Asked Questions
Do CMD and PowerShell handle this error differently?
A little, but not in the way that matters most here. If the executable is on `PATH`, both should find it. If only one works, look for a shell profile, alias, or stale session issue instead of assuming the install is broken.
Do I need to run the terminal as Administrator?
Usually no. You only need Administrator access if you are changing system-wide environment variables or installing into a protected folder. For a user-level install, a normal terminal is enough.
Why does `where codex` find nothing even though I installed it?
Most often because the install folder is not on `PATH`, the command name is different from the one you typed, or you opened the terminal before the `PATH` change and it has not picked up the update yet.
What if the installer says it installed Codex CLI, but the file is gone later?
Check antivirus quarantine and any cleanup tools first. If the file was removed, the safest fix is usually to reinstall from a clean shell after you confirm the install folder is allowed.