Based on OpenAI’s official docs, checked
Codex on Windows: native sandbox setup, WSL and fixes
Codex runs on Windows in the ChatGPT desktop app, the CLI and the IDE extension, and it no longer needs WSL or a virtual machine: it can run natively in PowerShell with a Windows sandbox that limits what commands can read, write and reach on the network. This guide covers the Windows versions OpenAI supports, the three sandbox implementations and how to choose one in config.toml, a one-line test for the recommended MXC sandbox, when WSL is still the better choice, and fixes for the errors OpenAI documents, such as failed elevated setup and Windows error 1385. Everything here comes from OpenAI’s Codex Windows and config docs, checked October 29, 2026.
1. Check your Windows version and winget
OpenAI recommends Windows 11. A recent, fully updated Windows 10 works on a best-effort basis and needs version 1809 or newer for ConPTY console support. winget should be available.
winver winget --version2. Install Codex CLI
Open a new PowerShell window and run the standalone installer; our install guide has the npm and other options.
powershell -ExecutionPolicy ByPass -c "irm https://chatgpt.com/codex/install.ps1 | iex"3. Prefer the MXC sandbox
The desktop app prefers MXC automatically for consumer accounts on supported devices. For the standalone CLI, turn on the same behavior in config.toml and keep a legacy fallback for devices without MXC.
[features] prefer_mxc = true [windows] sandbox = "elevated" # legacy fallback4. Test MXC on one command
In Codex CLI 0.162.0 and later, run this from your project directory. Expect MXC_OK and exit code 0. It does not change your saved sandbox selection.
codex -c windows.sandbox=mxc sandbox --include-managed-config --permission-profile :workspace -- cmd.exe /d /c echo MXC_OK $LASTEXITCODE
The three Windows sandboxes
mxc is the recommended sandbox on compatible devices. It uses Microsoft Execution Containers for native process isolation, with no administrator-approved setup, extra Windows accounts or firewall rules. Microsoft introduced it in Windows 11 24H2 (build 26100.9278) and 25H2 (build 26200.9278) and is still rolling it out.
elevated is the preferred legacy fallback. It needs administrator-approved setup and creates lower-privilege sandbox users, firewall rules and local policy changes; commands in it run without administrator rights.
unelevated is the last fallback, for when elevated setup is blocked and policy allows it. It uses a restricted token from your own user and ACL-based file boundaries, but has weaker network isolation and does not support denied read paths.
MXC limits to know
Child processes still running stop when the foreground command exits, so test workflows that rely on detached development servers. Deny-read globs are matched when each sandboxed process starts, so files created later stay readable to that process. Managed networking needs allow_local_binding = true.
Native Windows or WSL?
OpenAI says to use the native Windows sandbox by default. Choose WSL when you need Linux-native tooling, your workflow already lives in WSL2, or the native Windows sandboxes don’t meet your needs.
Company laptops without admin rights
IT can install the CLI and provision the elevated sandbox for an employee from an elevated deployment process. The command reads that user’s configuration, sets up the sandbox and saves windows.sandbox = "elevated"; the employee then runs Codex from a normal terminal. Admins can also allow or block sandbox types in requirements.toml.
codex sandbox setup --elevated --user 'DOMAIN\alice' --codex-home 'C:\Users\alice\.codex' Fixing common errors
Elevated setup failed: the usual causes are a declined UAC prompt, or a machine that blocks creating local users or groups, changing firewall rules or granting the logon rights the sandbox users need. Retry and approve the prompt, ask IT about those permissions, or use unelevated if policy allows while it is investigated.
Windows error 1385: Windows is denying the logon type the sandbox user needs. Ask IT to grant the required logon rights to the Codex-created sandbox users, and use unelevated meanwhile if you need to keep working.
Folders writable by Everyone: remove Everyone write access from the folders Codex lists, then restart Codex or rerun sandbox setup.
IDE extension installed but unresponsive: install the Visual Studio Build Tools C++ workload and the x64 Visual C++ Redistributable, then fully restart VS Code.
winget install --id Microsoft.VisualStudio.2022.BuildTools -e Sending diagnostics
If problems continue, OpenAI asks for CODEX_HOME/.sandbox/sandbox.log, the sandbox implementation in use, any error shown, your Windows build and whether you are on Windows 10 or 11. Do not send the contents of CODEX_HOME/.sandbox-secrets/.
Tips
- Use /status and /debug-config in the CLI to see the active permission profile and configuration when a command can’t read a folder.
- Ask your administrator to review a managed restriction rather than disabling the sandbox.
- Avoid full access mode for automation; OpenAI warns Codex is then not limited to your project directory.
- After moving a repo or changing Windows policies, restart Codex and rerun the MXC probe or elevated setup if sandboxing stops working.
Next steps
Verified MCP servers for Codex
Generate an MCP config for Codex
OpenAI Codex hub
Claude Code vs OpenAI Codex: documented features compared
OpenAI Codex vs Cursor: documented features compared
How to add an MCP server to Codex
How to add an MCP server to Cursor
How to add an MCP server to GitHub Copilot in VS Code
How to add an MCP server to Google Antigravity
How to migrate from Gemini CLI to Antigravity CLI
Portable agent skills: one SKILL.md for every coding agent
Safe “always allow” rules for Claude Code and Codex CLI
GitHub Copilot CLI yolo mode: --allow-all and safer tool rules
Codex sandbox modes and approval policies explained
How to install Claude Code on macOS, Linux and Windows
How to install the OpenAI Codex CLI
Claude Code auto mode: what runs, what gets blocked, how to turn it off
Agent Skills moves to the Agentic AI Foundation: what changes
MCP security: the risks in MCP servers and how to lock them down
Claude Code in VS Code: install, shortcuts and CLI differences
What is AGENTS.md? The open instruction file for coding agents
Claude Code on Windows: native, WSL and common errors
Codex skills: create, install and use SKILL.md skills in Codex
GitHub Copilot CLI: install, sign in and start using it
Cursor Agent SDK: build, test and deploy agents as code
GPT-6.1 Terra in Codex and the API: setup, pricing and limits
MCP OAuth: connect a remote MCP server in Claude Code, Codex and Cursor
Codex config.toml: location, precedence and the settings to change
Antigravity CLI (agy): install, sign in, modes and commands
Google Antigravity on Windows: install, WSL, sandbox and fixes
GitHub Copilot coding agent (now cloud agent): how to use it
GitHub Copilot agent mode: how to use it in your IDE
Codex
How to install Codex CLI
Codex config.toml: location and options
Codex sandbox modes and approval policies
Claude Code on Windows
Frequently asked questions
Yes. Codex runs on Windows in the ChatGPT desktop app, the CLI and the IDE extension, natively in PowerShell with a Windows sandbox, so WSL is optional.
Sources
- https://developers.openai.com/codex/windows · checked 2026-10-29
- https://developers.openai.com/codex/config-basic · checked 2026-10-29