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.
- One command installs it: the PowerShell script from
chatgpt.com/codex/install.ps1. - Native Windows has a real sandbox now, in two modes:
elevatedandunelevated. elevatedis 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/cwhile 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.
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.
| Route | Command | Updates with | Notes |
|---|---|---|---|
| Standalone installer | irm https://chatgpt.com/codex/install.ps1 | iex | Re-run the same command, or codex update | Recommended. Lands in %LOCALAPPDATA%\Programs\OpenAI\Codex\bin |
| npm | npm install -g @openai/codex | npm install -g @openai/codex | Needs Node; the global prefix moves when Node does |
| GitHub Release binary | Download codex-x86_64-pc-windows-msvc.exe | Download again | For pinned or air-gapped installs |
$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 Windows | WSL2 | |
|---|---|---|
| Sandbox mechanism | Windows sandbox, elevated or unelevated | The Linux sandbox (bubblewrap) |
| Filesystem confinement | Yes, ACL and sandbox-user boundaries | Yes, namespace isolation |
| Network off by default | Yes | Yes |
| Setup cost | One administrator prompt for elevated | Install WSL, install a distro, install bubblewrap |
| Speed on your repo | Native | Native if the repo lives in the Linux filesystem |
| Linux toolchain (make, musl, docker) | Whatever Windows has | Native |
| Blocked by enterprise policy | Sometimes, for elevated | Sometimes, 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.
| Mode | How it confines | When you get it |
|---|---|---|
elevated | Dedicated lower-privilege sandbox users, filesystem permission boundaries, firewall rules, local policy changes | Preferred. Needs an administrator-approved setup step |
unelevated | A restricted token derived from your own user, ACL filesystem boundaries, environment-level offline controls | Fallback when administrator setup is blocked by policy |
[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
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.
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.
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.
[windows]
allowed_sandbox_implementations = ["elevated"]
What Windows itself has to provide
Windows support levels, from the OpenAI Windows documentation, August 2026.
| Windows version | Support | Why |
|---|---|---|
| Windows 11 | Recommended | The baseline to standardise an enterprise deployment on |
| Recent, fully updated Windows 10 | Best effort | Needs modern console support; in practice 1809 or newer for ConPTY |
| Older Windows 10 builds | Not recommended | Likely to miss ConPTY and to fail in managed setups |
wingetshould be present. If it is missing, update Windows or install the Windows Package Manager before setting Codex up.- The
elevatedsandbox 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
gitfor diffs, commits and the built-in pull-request helpers.
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.
wsl --install
wsl
# 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.
| Symptom | Cause | Fix |
|---|---|---|
codex is not recognised | PATH not reloaded, or install dir not on PATH | Open a new terminal; check %LOCALAPPDATA%\Programs\OpenAI\Codex\bin |
Windows error 1385 on every command | Policy denies the logon type the sandbox users need | Ask IT about logon rights; use unelevated meanwhile |
| "Codex switched me to the unelevated sandbox" | elevated setup did not complete | Re-run /setup-default-sandbox and approve the UAC prompt |
Warning that folders are writable by Everyone | Windows ACLs on those folders are too broad to protect | Remove Everyone write access, then re-run setup |
| A build cannot read a toolchain directory | Sandbox read boundary | /sandbox-add-read-dir C:\path |
npm install fails with a network error | Network is off in workspace-write by design | Set sandbox_workspace_write.network_access = true deliberately |
| Everything is slow under WSL | Repository is on /mnt/c | Move it to ~/code; wsl --update then wsl --shutdown |
\r errors in shell scripts | CRLF line endings | git config --global core.autocrlf input |
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.