Windows Codex App cannot locate CLI when installed on non-standard drive

Open 💬 8 comments Opened May 14, 2026 by Y1-Bit

What version of the Codex App are you using (From “About Codex” dialog)?

26.506.31421

What subscription do you have?

Pro

What platform is your computer?

Microsoft Windows NT 10.0.26200.0 x64

What issue are you seeing?

Environment:

  • Windows 11
  • WSL2 Ubuntu
  • Codex Windows Desktop App
  • Codex CLI installed both on Windows and WSL

Problem:
After enabling WSL integration, the Codex desktop app started showing:

"Unable to locate the Codex CLI binary. Set CODEX_CLI_PATH or ensure the Electron resources include bin/codex."

<img width="680" height="221" alt="Image" src="https://github.com/user-attachments/assets/cbe12828-fb6f-472b-b509-806286571af3" />

Initially this looked like a WSL integration issue, but the actual root cause appears related to installing Codex on a non-standard drive (E: instead of C:).

What fixed it:
Moving/reinstalling Codex to the default C: drive immediately resolved the problem.

This suggests the Electron desktop app may have issues with:

  • non-standard installation drives
  • PATH propagation
  • Windows environment resolution
  • or WSL integration combined with custom install paths

What steps can reproduce the bug?

  1. Set a custom installation drive in Windows Settings for Microsoft Store apps: System -> Storage -> Advanced storage settings -> Where new content is saved (for example E: instead of C:) .
  2. Install the Codex Windows app from the Microsoft Store.
  3. Open Codex and go to: Settings -> Agent Environment
  4. Set the environment to: Windows Subsystem for Linux
  5. (Optional) Set the integrated terminal shell to WSL as well.
  6. Fully terminate all Codex processes via Task Manager.
  7. Relaunch the Codex app.

What is the expected behavior?

_No response_

Additional information

_No response_

View original on GitHub ↗

8 Comments

git97shunxin · 2 months ago

It did work when Codex was installed on C drive,I'm curious about how you found this solution

z1131392774 · 1 month ago
It did work when Codex was installed on C drive,I'm curious about how you found this solution当 Codex 安装在 C 驱动器上时,这是可以工作的,我对你是如何找到这个解决方案感到好奇

same.it work for me.thank u very much!

LCYing101 · 1 month ago

It did help me

Beowulfwar · 1 month ago

Workaround that fixed it for me on Windows + WSL

I was getting:

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

My setup:

Windows 11
Codex Desktop App
WSL enabled
Codex CLI installed in WSL

After reinstalling the Codex Desktop App, the error persisted. The key finding was that the Desktop App seemed to validate CODEX_CLI_PATH as a Windows path, but then execute it from the WSL/Linux side.

What did not work:

CODEX_CLI_PATH=C:\Users\jesse\AppData\Roaming\npm\codex.cmd

That produced a Linux shell syntax error because WSL tried to execute the Windows .cmd file.

This also did not work correctly:

CODEX_CLI_PATH=C:\Users\jesse\AppData\Roaming\npm\codex

That made WSL try to run the Windows npm package through /mnt/c/..., causing:

Missing optional dependency @openai/codex-linux-x64

The workaround was to create a Linux shell wrapper in a Windows-visible path and point CODEX_CLI_PATH to it.

In WSL:

cat > /mnt/c/Users/jesse/codex-wsl <<'EOF'
#!/usr/bin/env sh
exec /home/jesse/.local/bin/codex "$@"
EOF

chmod +x /mnt/c/Users/jesse/codex-wsl

/mnt/c/Users/jesse/codex-wsl --version

Then in PowerShell:

[Environment]::SetEnvironmentVariable("CODEX_CLI_PATH", "C:\Users\jesse\codex-wsl", "User")

Then I fully closed Codex Desktop and reopened it:

taskkill /IM Codex.exe /F

After reopening the app, Codex started successfully.

So the working setup was:

CODEX_CLI_PATH points to:
C:\Users\jesse\codex-wsl

That file is executed by WSL as:
/mnt/c/Users/jesse/codex-wsl

And the wrapper calls the real WSL CLI:
/home/jesse/.local/bin/codex

This suggests the Desktop App may be mixing Windows path validation with WSL execution when resolving CODEX_CLI_PATH.

cls1277 · 1 month ago
### Workaround that fixed it for me on Windows + WSL I was getting: `` Codex failed to start. Unable to locate the Codex CLI binary. Set CODEX_CLI_PATH or ensure the Electron resources include bin/codex. ` My setup: ` Windows 11 Codex Desktop App WSL enabled Codex CLI installed in WSL ` After reinstalling the Codex Desktop App, the error persisted. The key finding was that the Desktop App seemed to validate CODEX_CLI_PATH as a Windows path, but then execute it from the WSL/Linux side. What did **not** work: CODEX_CLI_PATH=C:\Users\jesse\AppData\Roaming\npm\codex.cmd That produced a Linux shell syntax error because WSL tried to execute the Windows .cmd file. This also did **not** work correctly: CODEX_CLI_PATH=C:\Users\jesse\AppData\Roaming\npm\codex That made WSL try to run the Windows npm package through /mnt/c/..., causing: ` Missing optional dependency @openai/codex-linux-x64 ` The workaround was to create a Linux shell wrapper in a Windows-visible path and point CODEX_CLI_PATH to it. In WSL: cat > /mnt/c/Users/jesse/codex-wsl <<'EOF' #!/usr/bin/env sh exec /home/jesse/.local/bin/codex "$@" EOF chmod +x /mnt/c/Users/jesse/codex-wsl /mnt/c/Users/jesse/codex-wsl --version Then in PowerShell: [Environment]::SetEnvironmentVariable("CODEX_CLI_PATH", "C:\Users\jesse\codex-wsl", "User") Then I fully closed Codex Desktop and reopened it: taskkill /IM Codex.exe /F After reopening the app, Codex started successfully. So the working setup was: ` CODEX_CLI_PATH points to: C:\Users\jesse\codex-wsl That file is executed by WSL as: /mnt/c/Users/jesse/codex-wsl And the wrapper calls the real WSL CLI: /home/jesse/.local/bin/codex ` This suggests the Desktop App may be mixing Windows path validation with WSL execution when resolving CODEX_CLI_PATH`.

thanks very much! This has bothered me for a long time.

koybe · 1 month ago
### Workaround that fixed it for me on Windows + WSL I was getting: `` Codex failed to start. Unable to locate the Codex CLI binary. Set CODEX_CLI_PATH or ensure the Electron resources include bin/codex. ` My setup: ` Windows 11 Codex Desktop App WSL enabled Codex CLI installed in WSL ` After reinstalling the Codex Desktop App, the error persisted. The key finding was that the Desktop App seemed to validate CODEX_CLI_PATH as a Windows path, but then execute it from the WSL/Linux side. What did **not** work: CODEX_CLI_PATH=C:\Users\jesse\AppData\Roaming\npm\codex.cmd That produced a Linux shell syntax error because WSL tried to execute the Windows .cmd file. This also did **not** work correctly: CODEX_CLI_PATH=C:\Users\jesse\AppData\Roaming\npm\codex That made WSL try to run the Windows npm package through /mnt/c/..., causing: ` Missing optional dependency @openai/codex-linux-x64 ` The workaround was to create a Linux shell wrapper in a Windows-visible path and point CODEX_CLI_PATH to it. In WSL: cat > /mnt/c/Users/jesse/codex-wsl <<'EOF' #!/usr/bin/env sh exec /home/jesse/.local/bin/codex "$@" EOF chmod +x /mnt/c/Users/jesse/codex-wsl /mnt/c/Users/jesse/codex-wsl --version Then in PowerShell: [Environment]::SetEnvironmentVariable("CODEX_CLI_PATH", "C:\Users\jesse\codex-wsl", "User") Then I fully closed Codex Desktop and reopened it: taskkill /IM Codex.exe /F After reopening the app, Codex started successfully. So the working setup was: ` CODEX_CLI_PATH points to: C:\Users\jesse\codex-wsl That file is executed by WSL as: /mnt/c/Users/jesse/codex-wsl And the wrapper calls the real WSL CLI: /home/jesse/.local/bin/codex ` This suggests the Desktop App may be mixing Windows path validation with WSL execution when resolving CODEX_CLI_PATH`.

it works for me, thanks!~ but i think it should be a bug of codex desktop itself @codex

BretJohnson · 1 month ago

Thank you, @Beowulfwar. That worked for me as well, though I had it adjust it since I had node installed with nvm:

#!/usr/bin/env sh

export PATH="/home/bret/.nvm/versions/node/v24.15.0/bin:$PATH"
exec /home/bret/.nvm/versions/node/v24.15.0/bin/codex "$@"
ethanyanjiali · 1 month ago

Thanks for the workaround, OAI team really need to fix their s