Codex CLI on Windows: native sandbox or WSL2

Windows is no longer the second-class Codex platform. There is an official PowerShell installer, a native Windows sandbox with two strength levels, and a WSL2 route that runs the Linux sandbox instead. Picking between them is the only decision that matters.

By the Continuum team. We build a workbench that runs Claude Code, Codex, and their peers, so the model rates quoted here are the ones our own cost analytics ship with.

The short version

Install with the PowerShell one-liner from chatgpt.com/codex/install.ps1, then run codex in a project folder. Native Windows uses a Windows sandbox in two modes, elevated and unelevated; WSL2 runs the Linux bubblewrap sandbox instead. Use native by default and WSL2 when your toolchain is already Linux. All facts checked against OpenAI docs in August 2026.

What you need to know
  • One command installs it: the PowerShell script from chatgpt.com/codex/install.ps1.
  • Native Windows has a real sandbox now, in two modes: elevated and unelevated.
  • elevated is the one you want. It needs an administrator prompt at setup.
  • WSL2 runs the Linux sandbox (bubblewrap). WSL1 was dropped in Codex 0.115.
  • Never keep a repository on /mnt/c while working from WSL. It is the single biggest speed loss.
  • Windows 11 is the supported baseline. Windows 10 needs 1809 or newer for ConPTY.

Install it in one command

Codex ships a signed standalone installer for Windows. It is the route OpenAI documents first, and it is the one that self-updates cleanly.

Windows PowerShell or Windows Terminal. Same command installs and updates.
powershell -ExecutionPolicy ByPass -c "irm https://chatgpt.com/codex/install.ps1 | iex"

codex --version

The three Windows install routes, checked against the OpenAI docs in August 2026.

RouteCommandUpdates withNotes
Standalone installerirm https://chatgpt.com/codex/install.ps1 | iexRe-run the same command, or codex updateRecommended. Lands in %LOCALAPPDATA%\Programs\OpenAI\Codex\bin
npmnpm install -g @openai/codexnpm install -g @openai/codexNeeds Node; the global prefix moves when Node does
GitHub Release binaryDownload codex-x86_64-pc-windows-msvc.exeDownload againFor pinned or air-gapped installs
Unattended, for a provisioning script.
$env:CODEX_NON_INTERACTIVE=1
irm https://chatgpt.com/codex/install.ps1 | iex

There is no Homebrew route on Windows. The codex Homebrew cask ships macOS binaries only.

Native Windows or WSL2

This is the whole decision, and the answer changed in 2026. Native Windows used to mean giving up the sandbox. It no longer does.

Native WindowsWSL2
Sandbox mechanismWindows sandbox, elevated or unelevatedThe Linux sandbox (bubblewrap)
Filesystem confinementYes, ACL and sandbox-user boundariesYes, namespace isolation
Network off by defaultYesYes
Setup costOne administrator prompt for elevatedInstall WSL, install a distro, install bubblewrap
Speed on your repoNativeNative if the repo lives in the Linux filesystem
Linux toolchain (make, musl, docker)Whatever Windows hasNative
Blocked by enterprise policySometimes, for elevatedSometimes, for WSL itself

The native Windows sandbox has two strengths

When Codex runs natively on Windows, it blocks writes outside the working folder and blocks network access without your approval. It does that in one of two ways, and which one you get is worth checking rather than assuming.

ModeHow it confinesWhen you get it
elevatedDedicated lower-privilege sandbox users, filesystem permission boundaries, firewall rules, local policy changesPreferred. Needs an administrator-approved setup step
unelevatedA restricted token derived from your own user, ACL filesystem boundaries, environment-level offline controlsFallback when administrator setup is blocked by policy
%USERPROFILE%\.codex\config.toml
[windows]
sandbox = "elevated"   # or "unelevated"

# Both modes use a private desktop for UI isolation by default.
# Only turn this off for a compatibility problem you can name.
# sandbox_private_desktop = false
01

Run the setup once

/setup-default-sandbox

Approve the administrator prompt. This is what creates the sandbox users, the firewall rules and the logon rights the elevated mode needs.

02

Confirm which mode you actually got

/status

It prints the active model, approval policy and writable roots. If Codex silently fell back to unelevated, the setup did not complete.

03

Widen reads, not writes, when something fails

/sandbox-add-read-dir C:\absolute\directory\path

The path has to be an existing absolute directory. Commands later in the same session can then read it. This is almost always the right fix for a sandboxed build that cannot see a toolchain, and it is far narrower than turning the sandbox off.

requirements.toml, for admins who want to forbid the weaker fallback.
[windows]
allowed_sandbox_implementations = ["elevated"]

What Windows itself has to provide

Windows support levels, from the OpenAI Windows documentation, August 2026.

Windows versionSupportWhy
Windows 11RecommendedThe baseline to standardise an enterprise deployment on
Recent, fully updated Windows 10Best effortNeeds modern console support; in practice 1809 or newer for ConPTY
Older Windows 10 buildsNot recommendedLikely to miss ConPTY and to fail in managed setups
  • winget should be present. If it is missing, update Windows or install the Windows Package Manager before setting Codex up.
  • The elevated sandbox depends on an administrator-approved setup step.
  • Some managed devices block that setup even on a perfectly acceptable OS build.
  • Install Git for Windows. Codex shells out to git for diffs, commits and the built-in pull-request helpers.
The two things worth installing before Codex.
winget install Git.Git
winget install Microsoft.WindowsTerminal

# CRLF is the other Windows-only source of mystery failures
git config --global core.autocrlf input

The WSL2 route

WSL2 is the right answer when your build already assumes Linux. Codex then runs entirely inside the distro and uses the Linux sandbox, which means it needs bubblewrap installed there.

From an elevated PowerShell.
wsl --install
wsl
Inside the distro.
# the Linux sandbox needs this
sudo apt update && sudo apt install -y bubblewrap git curl ripgrep

# install Codex itself
curl -fsSL https://chatgpt.com/codex/install.sh | sh

# work in the LINUX filesystem, not /mnt/c
mkdir -p ~/code && cd ~/code
git clone https://github.com/your/repo.git
cd repo
codex

When it goes wrong

Windows-specific failures and what each one actually means.

SymptomCauseFix
codex is not recognisedPATH not reloaded, or install dir not on PATHOpen a new terminal; check %LOCALAPPDATA%\Programs\OpenAI\Codex\bin
Windows error 1385 on every commandPolicy denies the logon type the sandbox users needAsk IT about logon rights; use unelevated meanwhile
"Codex switched me to the unelevated sandbox"elevated setup did not completeRe-run /setup-default-sandbox and approve the UAC prompt
Warning that folders are writable by EveryoneWindows ACLs on those folders are too broad to protectRemove Everyone write access, then re-run setup
A build cannot read a toolchain directorySandbox read boundary/sandbox-add-read-dir C:\path
npm install fails with a network errorNetwork is off in workspace-write by designSet sandbox_workspace_write.network_access = true deliberately
Everything is slow under WSLRepository is on /mnt/cMove it to ~/code; wsl --update then wsl --shutdown
\r errors in shell scriptsCRLF line endingsgit config --global core.autocrlf input
Before you file a bug, produce the report the maintainers ask for.
codex doctor

It checks installation, configuration, authentication, runtime, Git, terminal and app-server health in one pass, which is usually faster than describing the symptom. For a sandbox failure specifically, send CODEX_HOME\.sandbox\sandbox.log with your Windows version.

Questions people ask

Yes. Install it with the PowerShell one-liner from chatgpt.com/codex/install.ps1, or with npm. Native runs use a Windows sandbox rather than requiring WSL, which is a change from earlier releases.

Yes, in two strengths. The elevated mode uses dedicated lower-privilege sandbox users, filesystem permission boundaries and firewall rules. The unelevated fallback uses a restricted token and ACL boundaries, and is weaker. Check which you have with /status.

Use native by default as of August 2026. Choose WSL2 when you need Linux-native tooling, when your repositories already live in WSL2, or when neither native sandbox mode works on your machine.

Almost always because the repository sits on /mnt/c. Every read crosses the Windows filesystem boundary and an agent reads constantly. Clone into your Linux home directory instead.

No. WSL1 was supported through Codex 0.114. From 0.115 the Linux sandbox moved to bubblewrap, which WSL1 cannot provide. Convert the distro to WSL2 or use the native Windows route.

Windows is denying the logon type the sandbox users need in order to start a command. The sandbox users were created successfully but policy blocks them. Ask IT about logon rights, and use the unelevated sandbox while that is investigated.

Run /sandbox-add-read-dir C:\absolute\path inside the session. It grants read access for the rest of that session and is far narrower than switching the sandbox off.

Windows 11 is the recommended baseline. Recent fully updated Windows 10 is best effort and needs 1809 or newer for ConPTY. Older Windows 10 builds are not recommended.

Sources

Every figure above was read from these pages on August 2026. Vendors reprice without notice; if you find a stale number, tell us.

  1. OpenAI Codex documentation
  2. Codex on Windows: native sandbox
  3. Codex on WSL
  4. openai/codex on GitHub
Try it

Windows client,
any host.

Continuum runs on Windows and drives agents on your Mac or Linux boxes, with every session, diff and quota gauge in one place.

free app · your subscriptions · local-first