Before you start: make sure it’s WSL2
From PowerShell:
wsl -l -v
The VERSION column must say 2. If it says 1, convert the distribution with wsl --set-version <DistroName> 2. OpenAI’s docs say WSL1 was supported only through Codex 0.114. See the WSL1 error.
Option A: Desktop app with the agent in WSL
- Open Settings in the ChatGPT desktop app.
- Switch the agent from Windows native to WSL.
- Restart the app. The change doesn’t take effect until you do. Your projects stay in place.
The integrated terminal is configured separately. You can run the agent in WSL and still use PowerShell in the terminal, or use WSL for both.
Option B: Codex CLI inside WSL2
Open your WSL2 shell and use the Linux installer:
curl -fsSL https://chatgpt.com/codex/install.sh | sh
codex
Share config, sign-in, and history between Windows and WSL
The Windows app keeps its Codex home at %USERPROFILE%\.codex. A CLI inside WSL uses ~/.codex by default, so the two don’t share settings, cached auth, or sessions. To share them, point WSL at the Windows directory:
export CODEX_HOME=/mnt/c/Users/<windows-user>/.codex
Add that line to ~/.bashrc or ~/.zshrc to make it permanent.
Where to keep your projects
If you keep using the Windows-native agent, OpenAI recommends storing projects on the Windows drive and reaching them from WSL via /mnt/<drive>/.... Opening projects from \\wsl$\ works, but Git may not be detected. See the fix.