Codex for Windows comes in three forms: the ChatGPT desktop app (the Codex docs’ name for the app), the codex command line, and the IDE extension for VS Code. All three run natively on Windows 11, with a Windows sandbox that keeps the agent’s commands inside your project, or inside WSL2 with the Linux sandbox. Most people want the desktop app from the Microsoft Store, or the CLI from one PowerShell command.
The CLI in one line:
powershell -ExecutionPolicy ByPass -c "irm https://chatgpt.com/codex/install.ps1 | iex"
Open a new terminal, go to your project and run codex. Choose Sign in with ChatGPT.
Which Codex should I install?
| You want | Install | Runs commands in |
|---|---|---|
| A window with chats, diffs and a terminal | The ChatGPT desktop app | PowerShell, or WSL2 if you switch the agent |
| Codex in your shell or scripts | The CLI, from PowerShell or npm | PowerShell |
| Codex inside VS Code | The extension openai.chatgpt from the Marketplace | Your VS Code environment |
| Linux tooling, or your code already lives in WSL | The CLI inside WSL2 | Bash in Linux |
They share one home folder on Windows, %USERPROFILE%\.codex, with your config.toml, sign-in and sessions.
How do I download the Codex desktop app on Windows?
The app is in the Microsoft Store. Install it from the Store page, or from a terminal:
winget install --id 9PLM9XGG6VKS -s msstore
Both routes go through the Store catalog. Open the app from the Start menu, sign in with your ChatGPT account, and add a project folder.
Install Git and the GitHub CLI too. The app needs Git for its review panel and gh for GitHub features:
winget install --id Git.Git
winget install --id GitHub.cli
gh auth login
Without the Microsoft Store. OpenAI publishes offline MSIX packages for managed machines, with a license file:
https://persistent.oaistatic.com/codex-app-prod/ChatGPT-x64.msixhttps://persistent.oaistatic.com/codex-app-prod/ChatGPT-arm64.msixhttps://persistent.oaistatic.com/codex-app-prod/ChatGPT-License.xml
Rename the package to ChatGPT.msix, keep it next to the license, and install it from an elevated PowerShell:
Add-AppxProvisionedPackage -Online `
-PackagePath .\ChatGPT.msix `
-LicensePath .\ChatGPT-License.xml `
-Regions all
This needs admin rights and provisions the app for every user on the machine. If it doesn’t appear, sign out and back in. The app still updates itself afterwards, from persistent.oaistatic.com.
How do I install the Codex CLI on Windows?
Pick one route and stick to it:
| Route | Command | Notes |
|---|---|---|
| PowerShell installer | powershell -ExecutionPolicy ByPass -c "irm https://chatgpt.com/codex/install.ps1 | iex" | Installs into your user profile and adds it to your user PATH. Rerun it to update |
| npm | npm install -g @openai/codex | Needs Node.js. Update with the same command |
| GitHub release | codex-x86_64-pc-windows-msvc.exe.zip or the aarch64 file from the releases page | For pinned or offline setups |
The PowerShell installer downloads from releases.openai.com and falls back to GitHub. If your network blocks the first, force GitHub:
$env:CODEX_INSTALLER_USE_RELEASES_OPENAI_COM='false'; irm https://chatgpt.com/codex/install.ps1 | iex
To pin a version, download the script and pass -Release:
Invoke-WebRequest -UseBasicParsing -Uri 'https://chatgpt.com/codex/install.ps1' -OutFile '.\codex-install.ps1'
powershell -ExecutionPolicy Bypass -File .\codex-install.ps1 -Release <version>
The single-exe trap: OpenAI’s deployment guide warns that copying only
codex.exeisn’t a complete install. If the sandbox misbehaves after a manual copy, reinstall with the script or npm.
With npm, PowerShell can refuse to run the codex and npm launchers with “cannot be loaded because running scripts is disabled on this system”, so neither command starts. The fix the Codex docs give is Set-ExecutionPolicy -ExecutionPolicy RemoteSigned. Read Microsoft’s note on execution policies first; on a work machine, ask IT.
Check what you have with Get-Command codex and codex --version. Two installs on PATH, say npm and the script, is the usual reason an update “didn’t work”.
How do I sign in: ChatGPT plan or API key?
| Method | Command | Billed to |
|---|---|---|
| ChatGPT account (default) | codex login, then the browser | Your ChatGPT plan |
| Device code | codex login --device-auth | Your ChatGPT plan. Turn on device code login in your ChatGPT security settings first |
| API key | $env:OPENAI_API_KEY | codex login --with-api-key | Standard API rates, not your plan |
The Codex docs recommend the API key for CI and scripts. Some features may not be available with a key; the Codex pricing page lists which. codex login status shows which method is active.
Cached sign-ins live in %USERPROFILE%\.codex\auth.json or in Windows Credential Manager, set by cli_auth_credentials_store (file, keyring, auto or ephemeral) in config.toml. Treat auth.json like a password.
PowerShell or WSL?
| Native (PowerShell) | WSL2 | |
|---|---|---|
| Sandbox | Windows sandbox (MXC, or a legacy fallback) | Linux sandbox (bubblewrap) |
| Your projects | On C:\ as usual | Fastest in the Linux home folder, ~/code/... |
| Toolchain | Windows: .NET, PowerShell scripts, Visual Studio | Linux: Bash scripts, most Unix-first tooling |
| Setup | Nothing extra | wsl --install, then Codex inside Linux |
Native is the default and the better choice for Windows projects. Choose WSL2 when your build expects Linux, when your work already lives there, or when the Windows sandbox won’t run on your machine. WSL1 is not supported since Codex 0.115.
CLI in WSL2:
wsl --install
Then, inside the Linux shell:
curl -fsSL https://chatgpt.com/codex/install.sh | sh
codex
Desktop app in WSL2: open Settings (codex://settings), switch Agent environment from Windows native to Windows Subsystem for Linux, and restart the app. The change doesn’t apply until you do.
VS Code with WSL: install the WSL extension (ms-vscode-remote.remote-wsl), run code . from the WSL shell in your project, and check that the status bar says WSL: <distro>.
Share one sign-in between Windows and WSL by pointing the WSL CLI at the Windows home folder. Add this to ~/.bashrc:
export CODEX_HOME=/mnt/c/Users/<windows-user>/.codex
The Codex WSL guide says to keep repositories in the Linux home folder, not under /mnt/c, for speed. The desktop app guide says projects on the Windows drive, opened as /mnt/<drive>/..., are more reliable, and that Git isn’t detected for projects opened through \\wsl$. Both are right for their surface: CLI in WSL, keep code in Linux; desktop app with a WSL agent, keep code on C:\.
How does the Windows sandbox work?
With the usual setup, Codex runs commands freely inside the project and asks before anything that leaves it. On Windows, three implementations enforce that:
| Implementation | Needs | Notes |
|---|---|---|
mxc | Windows 11 24H2 build 26100.9278 or 25H2 build 26200.9278, or later. No admin | Recommended. Native process isolation, no extra accounts or firewall rules |
elevated | An admin-approved setup step | The preferred fallback. Creates lower-privilege sandbox users, firewall rules and policy changes |
unelevated | Nothing | Last resort. Weaker network isolation and no denied read paths |
Check your build with winver. Microsoft is still rolling MXC out, so a fully updated machine may not have it yet.
The desktop app prefers MXC on its own for consumer accounts. For the CLI, turn it on in %USERPROFILE%\.codex\config.toml:
[features]
prefer_mxc = true
Or pick an implementation directly:
[windows]
sandbox = "elevated" # or "mxc", "unelevated"
Test it from your project folder (CLI 0.162.0 or later):
codex -c windows.sandbox=mxc sandbox --include-managed-config --permission-profile :workspace -- cmd.exe /d /c echo MXC_OK
$LASTEXITCODE
MXC_OK and 0 mean the sandbox works. Inside a session, /status shows your permissions and writable folders, and /debug-config shows whether a managed config overrides yours.
In the desktop app, the sandbox applies when Ask for approval is selected under the composer. Full access mode lets Codex act outside the project, and the docs warn this can lose data.
Older guides tell you to start Codex with --full-auto and change approvals with /approvals, but neither exists anymore, so those commands fail. Use /permissions in a session, or --approve-for-me to let an automatic reviewer handle approvals inside the sandbox. See YOLO mode for what each switch turns off.
Why does the Codex sandbox fail on Windows?
| What you see | Cause | Fix |
|---|---|---|
| Legacy setup failed | A declined UAC prompt, or policy blocks creating users, firewall rules or logon rights | Retry and accept UAC, ask IT, or use unelevated if policy allows |
| Error 1385 | Windows denies the logon type the sandbox user needs | Ask IT to grant the logon right; send them CODEX_HOME\.sandbox\sandbox.log |
| ”Writable by Everyone” warning | A folder in the workspace grants write access to Everyone | Remove that permission, then restart Codex or re-run setup |
| Network unreachable | The chat runs without network on purpose, or the sandbox broke | Check the chat’s permissions; otherwise restart and collect the log |
| Sandbox stopped working | You moved the repo, changed folder permissions, or Windows policy changed | Restart Codex, rerun the MXC probe or the elevated setup |
| Dev server dies after the command ends | MXC stops child processes when the foreground command exits | Start long-running servers yourself, outside the agent |
/setup-default-sandbox appears in the CLI only when Codex has fallen back to the restricted-token sandbox; it runs the elevated setup. To remove the legacy sandbox’s accounts and firewall rules, run codex sandbox uninstall as administrator.
The log is at %USERPROFILE%\.codex\.sandbox\sandbox.log. When you file a bug, include it with your Windows build and which implementation was active. Never share the .sandbox-secrets folder.
Why does Codex keep crashing on Windows?
Most reports are about the desktop app, not the CLI. The ones with open GitHub issues as of November 2026:
- The app crashes when it uses its built-in browser. Issue 32683 has 170+ comments. Avoid Browser Use tasks until it’s closed.
- “Not responding” on every launch. Issue 27809 traces it to
VCPkgSrv.execrashing. - Hangs on the logo after a Windows update, or crashes right at start. Reported on several 25H2 builds. Update the app from the Store first.
- Crashes after adding a project with several root folders, then reopening the same state on every start. Until it is fixed, add projects one folder at a time.
The IDE extension has its own documented fix. If it stops responding, install the C++ build tools and the x64 Visual C++ Redistributable, then fully restart VS Code:
winget install --id Microsoft.VisualStudio.2022.BuildTools -e
Other Windows traps from the docs:
- The agent needs admin rights for a task. Start the app with Run as administrator; the agent inherits it. Do this only for that task.
- Git features missing. Install Git natively with
winget install Git.Git, even if you have Git in WSL. - Cmder is missing from the “Open” list. Right-click Cmder, choose Add to Start, then restart Codex.
Contenox
Contenox is a Windows desktop app that can use your ChatGPT subscription too: sign in with a device code, open a project folder, and the agent works there while you approve. Its rules are visible under Permissions, and on Windows a sandbox limits writes to the project folder; reads can’t be restricted there. See ChatGPT subscription and download it.
Related guides
- AI coding agents on Windows: which agents run natively and which need WSL
- Claude Code on Windows: the same setup for Claude Code
- Why does my coding agent keep asking for permission?: Codex’s network and folder prompts explained
- How to sandbox AI coding agents: when the built-in sandbox isn’t enough