For creatorsMake videos about AI coding? Earn 50% for life.Earn 50% for life.Become a Morphy creatorJoin →
morphy

How to install and use Codex on Windows (2026): app, CLI, sandbox and WSL

Codex on Windows 10 and 11 in 2026: the ChatGPT desktop app, the Codex CLI in PowerShell, the Windows sandbox (MXC, elevated, unelevated), WSL2, and fixes for the common errors.

Short answer: Codex runs natively on Windows, with no WSL needed. The easiest way is the ChatGPT desktop app from the Microsoft Store, where Codex lives next to Chat. For the terminal, install the Codex CLI in PowerShell with one line, then type codex in your project folder. Either way, Codex runs commands inside a Windows sandbox that keeps it to your project, and you can switch to WSL2 if you need Linux tools.

Everything below is from OpenAI's own Codex documentation, checked on November 3, 2026. (I build Morphy, a Windows app that runs Codex next to other AIs; it gets one line near the end.)

What you need

  • Windows 11 (recommended) or a recent, fully updated Windows 10, version 1809 or later. OpenAI calls Windows 10 "best effort": it works, but less reliably.
  • A ChatGPT plan. Free and Go get Codex in the desktop app only, with GPT-6 Luna. Plus ($20 a month) and up add the CLI, the IDE extension and cloud tasks. You can also sign in with an API key instead.
  • winget (the Windows Package Manager), which recent Windows versions have. Update Windows if it's missing.

The ChatGPT desktop app

Codex's desktop app is now part of the ChatGPT desktop app. Install it from the Microsoft Store, or from PowerShell:

winget install --id 9PLM9XGG6VKS -s msstore

On Windows it has the same core features as on a Mac: parallel chats, worktrees, scheduled tasks, Git, the built-in browser, file previews, plugins and skills. Two settings are worth a look:

  • Open: the editor a project opens in, like VS Code or Visual Studio.
  • Integrated terminal: PowerShell, Command Prompt, Git Bash or WSL. It only changes new terminals.

The Codex CLI in PowerShell

Open a new PowerShell window and run:

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

Run the same line again to update. If you'd rather use npm, npm install -g @openai/codex works too (it needs Node.js). Then go to your project folder, run codex, and choose Sign in with ChatGPT.

The Windows sandbox

When Codex runs natively on Windows, it runs its commands inside a sandbox that keeps them to the files and network access its permissions allow. There are three kinds, and Codex picks for you:

SandboxWhat it isWhen it's used
MXCWindows' own process isolation, with no admin setupThe recommended one, on Windows 11 24H2 or 25H2 builds that have it (Microsoft is rolling it out). The app prefers it for personal accounts
ElevatedSeparate low-privilege Windows users, file permissions and firewall rulesThe fallback when MXC isn't available. Needs you to approve an administrator prompt once
UnelevatedA restricted version of your own Windows userThe last fallback, when elevated setup is blocked. Weaker network isolation

To check whether your PC has MXC, run this in your project folder (Codex CLI 0.162 or later). It should print MXC_OK and 0:

codex -c windows.sandbox=mxc sandbox --include-managed-config --permission-profile :workspace -- cmd.exe /d /c echo MXC_OK
$LASTEXITCODE

The CLI can be told to prefer MXC in config.toml (in %USERPROFILE%\.codex):

[features]
prefer_mxc = true

OpenAI's advice is to keep the sandbox on. "Full access" mode lets Codex work outside your project, where a mistake can lose data.

Native Windows or WSL2?

Use the native agent by default. Choose WSL2 when you need Linux tools, your projects already live in WSL, or the Windows sandbox doesn't work on your PC.

  • In the app: open Settings, switch the agent from Windows native to WSL, and restart the app. To open a project stored in WSL, press Ctrl+O and type \\wsl$\ in the file window.
  • The CLI in WSL: install a distribution with wsl --install from an administrator PowerShell, open it with wsl, then install Codex the Linux way: curl -fsSL https://chatgpt.com/codex/install.sh | sh.
  • Keep projects in the right place. With the native agent, keep projects on your Windows drive. Inside WSL, keep them in your Linux home folder (like ~/code/my-app): /mnt/c/... is slower.
  • WSL1 doesn't work since Codex 0.115. Use WSL2.

The Windows app and the CLI in WSL keep separate settings, sign-ins and history. To share them, set CODEX_HOME in WSL to your Windows Codex folder, %USERPROFILE%\.codex.

Fixing the common errors

What you seeWhat it meansThe fix
The sandbox setup doesn't finishThe elevated setup was blocked: a declined admin prompt, or a company policyTry again and approve the prompt; on a work laptop, ask IT; meanwhile set sandbox = "unelevated" under [windows] in config.toml
Codex says it's using the unelevated sandboxElevated setup isn't available, so Codex fell backIt still works; check MXC, or ask IT to set up the elevated one
Windows error 1385Windows won't let the sandbox users start commandsAsk IT about the logon rights for Codex's sandbox users; use unelevated meanwhile
Some folders are "writable by Everyone"Their Windows permissions are too broad for the sandbox to protectRemove Everyone's write access, then restart Codex
npm.ps1 cannot be loaded because running scripts is disabled on this systemPowerShell's execution policy blocks scriptsSet-ExecutionPolicy -ExecutionPolicy RemoteSigned (read Microsoft's guide first)
Commands can't reach the internetSome permission modes run without network access on purposeCheck the mode; if you expected access, restart Codex
The IDE extension is installed but does nothingC++ build tools are missingwinget install --id Microsoft.VisualStudio.2022.BuildTools -e, then restart VS Code
Sandboxing worked, then stoppedYou moved the project, or Windows permissions or policies changedRestart Codex, then run the sandbox setup again

To run commands as administrator, start the ChatGPT app itself with Run as administrator: Codex gets the same rights. For anything else, OpenAI asks for CODEX_HOME\.sandbox\sandbox.log with your Windows build number (never the .sandbox-secrets folder).

Tools Codex works better with

Codex leans on a few common tools. Install them in one go from the app's terminal, or ask Codex to:

winget install --id Git.Git
winget install --id OpenJS.NodeJS.LTS
winget install --id Python.Python.3.14
winget install --id GitHub.cli

Git powers the app's review pane, and after installing the GitHub CLI, gh auth login turns on its GitHub features.

In Morphy

Morphy runs on Windows too, and a Codex chat in it runs the Codex CLI with your ChatGPT sign-in, next to Claude Code, Copilot and other AIs on one canvas. Settings installs Codex for you and shows how much of your plan you've used. See Connect your AI.

Questions

Does Codex work on Windows? Yes, natively: in the ChatGPT desktop app from the Microsoft Store, in the Codex CLI in PowerShell, and in the IDE extension. WSL2 is optional.

Do I need WSL for Codex? No. Codex runs natively in PowerShell with a Windows sandbox. Use WSL2 only if you need Linux tools or your projects already live there.

Does Codex work on Windows 10? Version 1809 or later, fully updated, but OpenAI calls it "best effort". Windows 11 is recommended.

Is Codex free on Windows? On ChatGPT's Free and Go plans, Codex works in the desktop app only, with GPT-6 Luna. The CLI and IDE extension need Plus ($20 a month) or higher, or an API key. See Codex's usage limits.

How do I install Codex without the Microsoft Store? Use the CLI's installer in PowerShell: powershell -ExecutionPolicy ByPass -c "irm https://chatgpt.com/codex/install.ps1 | iex", or npm install -g @openai/codex.

References