windows.md +215 −20
1# Windows1# Windows
2 2
33Tips for running Codex on WindowsUse Codex on Windows with the native [Codex app](https://developers.openai.com/codex/app/windows), the
4[CLI](https://developers.openai.com/codex/cli), or the [IDE extension](https://developers.openai.com/codex/ide).
4 5
56The easiest way to use Codex on Windows is to [set up the IDE extension](https://developers.openai.com/codex/ide) or [install the CLI](https://developers.openai.com/codex/cli) and run it from PowerShell.[
6 7
78When you run Codex natively on Windows, the agent mode uses an experimental Windows sandbox to block filesystem writes outside the working folder and prevent network access without your explicit approval. [Learn more below](#windows-experimental-sandbox).Use the Codex app on Windows
8 9
910Instead, you can use [Windows Subsystem for Linux](https://learn.microsoft.com/en-us/windows/wsl/install) (WSL2). WSL2 gives you a Linux shell, Unix-style semantics, and tooling that match many tasks that models see in training.Work across projects, run parallel agent threads, and review results in one place with the native Windows app.](https://developers.openai.com/codex/app/windows)
11
12Depending on the surface and your setup, Codex can run on Windows in three
13practical ways:
14
15- natively on Windows with the stronger `elevated` sandbox,
16- natively on Windows with the fallback `unelevated` sandbox,
17- or inside [Windows Subsystem for Linux](https://learn.microsoft.com/en-us/windows/wsl/install) (WSL), which uses the Linux sandbox implementation.
18
19## Windows sandbox
20
21When you run Codex natively on Windows, agent mode uses a Windows sandbox to
22block filesystem writes outside the working folder and prevent network access
23without your explicit approval.
24
25Native Windows sandbox support includes two modes that you can configure in
26`config.toml`:
27
28```toml
29[windows]
30sandbox = "elevated" # or "unelevated"
31```
32
33`elevated` is the preferred native Windows sandbox. It uses dedicated
34lower-privilege sandbox users, filesystem permission boundaries, firewall
35rules, and local policy changes needed for sandboxed command execution.
36
37`unelevated` is the fallback native Windows sandbox. It runs commands with a
38restricted Windows token derived from your current user, applies ACL-based
39filesystem boundaries, and uses environment-level offline controls instead of
40the dedicated offline-user firewall rule. It is weaker than `elevated`, but it
41is still useful when administrator-approved setup is blocked by local or
42enterprise policy.
43
44If both modes are available, use `elevated`. If the default native sandbox
45doesn't work in your environment, use `unelevated` as a fallback while you
46troubleshoot the setup.
47
48By default, both sandbox modes also use a private desktop for stronger UI
49isolation. Set `windows.sandbox_private_desktop = false` only if you need the
50older `Winsta0\\Default` behavior for compatibility.
51
52### Sandbox permissions
53
54Running Codex in full access mode means Codex is not limited to your project
55 directory and might perform unintentional destructive actions that can lead to
56 data loss. For safer automation, keep sandbox boundaries in place and use
57 [rules](https://developers.openai.com/codex/rules) for specific exceptions, or set your [approval policy to
58 never](https://developers.openai.com/codex/agent-approvals-security#run-without-approval-prompts) to have
59 Codex attempt to solve problems without asking for escalated permissions,
60 based on your [approval and security setup](https://developers.openai.com/codex/agent-approvals-security).
61
62### Windows version matrix
63
64| Windows version | Support level | Notes |
65| -------------------------------- | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
66| Windows 11 | Recommended | Best baseline for Codex on Windows. Use this if you are standardizing an enterprise deployment. |
67| Recent, fully updated Windows 10 | Best effort | Can work, but is less reliable than Windows 11. For Windows 10, Codex depends on modern console support, including ConPTY. In practice, Windows 10 October 2018 Update or newer is required. |
68| Older Windows 10 builds | Not recommended | More likely to miss required console components such as ConPTY and more likely to fail in enterprise setups. |
69
70Additional environment assumptions:
71
72- `winget` should be available. If it is missing, update Windows or install
73 the Windows Package Manager before setting up Codex.
74- The recommended native sandbox depends on administrator-approved setup.
75- Some enterprise-managed devices block the required setup steps even when the
76 OS version itself is acceptable.
77
78### Grant sandbox read access
79
80When a command fails because the Windows sandbox can't read a directory, use:
81
82```text
83/sandbox-add-read-dir C:\absolute\directory\path
84```
85
86The path must be an existing absolute directory. After the command succeeds, later commands that run in the sandbox can read that directory during the current session.
87
88We recommend using the native Windows sandbox by default. The native Windows sandbox will offer the best perfomance and highest speeds while keeping the same security. Choose WSL when you
89need a Linux-native environment on Windows, when your workflow already lives in
90WSL, or when neither native Windows sandbox mode meets your needs.
10 91
11## Windows Subsystem for Linux92## Windows Subsystem for Linux
12 93
94If you choose WSL, Codex runs inside the Linux environment instead of using the
95native Windows sandbox. This is useful if you need Linux-native tooling on
96Windows, if your repositories and developer workflow already live in WSL, or
97if neither native Windows sandbox mode works for your environment.
98
13### Launch VS Code from inside WSL99### Launch VS Code from inside WSL
14 100
15For step-by-step instructions, see the [official VS Code WSL tutorial](https://code.visualstudio.com/docs/remote/wsl-tutorial).101For step-by-step instructions, see the [official VS Code WSL tutorial](https://code.visualstudio.com/docs/remote/wsl-tutorial).
45 `WSL: Reopen Folder in WSL`, and keep your repository under `/home/...` (not131 `WSL: Reopen Folder in WSL`, and keep your repository under `/home/...` (not
46 `C:\`) for best performance.132 `C:\`) for best performance.
47 133
134If the Windows app or project picker does not show your WSL repository, type
135`\wsl$` into the file picker or Explorer, then navigate to your
136 distro's home directory.
137
48### Use Codex CLI with WSL138### Use Codex CLI with WSL
49 139
50Run these commands from an elevated PowerShell or Windows Terminal:140Run these commands from an elevated PowerShell or Windows Terminal:
83 ```173 ```
84- If you need Windows access to files, they’re under `\wsl$\Ubuntu\home<user>` in Explorer.174- If you need Windows access to files, they’re under `\wsl$\Ubuntu\home<user>` in Explorer.
85 175
86176## Windows experimental sandbox## Troubleshooting and FAQ
87 177
88178The Windows sandbox support is experimental. How it works:If you are troubleshooting a managed Windows machine, start with the native
179sandbox mode, Windows version, and any policy error shown by Codex. Most native
180Windows support issues come from sandbox setup, logon rights, or filesystem
181permissions rather than from the editor itself.
89 182
90183- Launches commands inside a restricted token derived from an AppContainer profile.My native sandbox setup failed
91- Grants only specifically requested filesystem capabilities by attaching capability security identifiers to that profile.
92- Disables outbound network access by overriding proxy-related environment variables and inserting stub executables for common network tools.
93 184
94185Its primary limitation is that it can’t prevent file writes, deletions, or creations in any directory where the Everyone SID already has write permissions (for example, world-writable folders). When using the Windows sandbox, Codex scans for folders where Everyone has write access and recommends that you remove that access.If Codex cannot complete the `elevated` sandbox setup, the most common causes
186are:
95 187
96188### Grant sandbox read access- the Windows UAC or administrator prompt was declined,
189- the machine does not allow local user or group creation,
190- the machine does not allow firewall rule changes,
191- the machine blocks the logon rights needed by the sandbox users,
192- or another enterprise policy blocks part of the setup flow.
97 193
98194When a command fails because the Windows sandbox can't read a directory, use:What to try:
99 195
100196```text1. Try the `elevated` sandbox setup again and approve the administrator prompt
101197/sandbox-add-read-dir C:\absolute\directory\path if your environment allows it.
102198```2. If your company laptop blocks this, ask your IT team whether the machine
199 allows administrator-approved setup for local user/group creation, firewall
200 configuration, and the required sandbox-user logon rights.
2013. If the default setup still fails, use the `unelevated` sandbox so you can
202 continue working while the issue is investigated.
103 203
104204The path must be an existing absolute directory. After the command succeeds, later commands that run in the sandbox can read that directory during the current session.Codex switched me to the unelevated sandbox
205
206This means Codex could not finish the stronger `elevated` sandbox setup on your
207machine.
208
209- Codex can still run in a sandboxed mode.
210- It still applies ACL-based filesystem boundaries, but it does not use the
211 separate sandbox-user boundary from `elevated` and has weaker network
212 isolation.
213- This is a useful fallback, but not the preferred long-term enterprise
214 configuration.
215
216If you are on a managed enterprise laptop, the best long-term fix is usually to
217get the `elevated` sandbox working with help from your IT team.
218
219I see Windows error 1385
220
221If sandboxed commands fail with error `1385`, Windows is denying the logon type
222the sandbox user needs in order to start the command.
223
224In practice, this usually means Codex created the sandbox users successfully,
225but Windows policy is still preventing those users from launching sandboxed
226commands.
227
228What to do:
229
2301. Ask your IT team whether the device policy grants the required logon rights
231 to the Codex-created sandbox users.
2322. Compare group policy or OU differences if the issue affects only some
233 machines or teams.
2343. If you need to keep working immediately, use the `unelevated` sandbox while
235 the policy issue is investigated.
2364. Send `CODEX_HOME/.sandbox/sandbox.log` along with your Windows version and a
237 short description of the failure.
238
239Codex warns that some folders are writable by Everyone
240
241Codex may warn that some folders are writable by `Everyone`.
242
243If you see this warning, Windows permissions on those folders are too broad for
244the sandbox to fully protect them.
245
246What to do:
247
2481. Review the folders Codex lists in the warning.
2492. Remove `Everyone` write access from those folders if that is appropriate in
250 your environment.
2513. Restart Codex or re-run the sandbox setup after those permissions are
252 corrected.
253
254If you are not sure how to change those permissions, ask your IT team for help.
255
256Sandboxed commands cannot reach the network
257
258Some Codex tasks are intentionally run without outbound network access,
259depending on the permissions mode in use.
260
261If a task fails because it cannot reach the network:
262
2631. Check whether the task was supposed to run with network disabled.
2642. If you expected network access, restart Codex and try again.
2653. If the issue keeps happening, collect the sandbox log so the team can check
266 whether the machine is in a partial or broken sandbox state.
267
268Sandboxing worked before and then stopped
269
270This can happen after:
271
272- moving a repo or workspace,
273- changing machine permissions,
274- changing Windows policies,
275- or other system configuration changes.
276
277What to try:
278
2791. Restart Codex.
2802. Try the `elevated` sandbox setup again.
2813. If that does not fix it, use the `unelevated` sandbox as a temporary
282 fallback.
2834. Collect the sandbox log for review.
284
285I need to send diagnostics to OpenAI
286
287If you still have problems, send:
288
289- `CODEX_HOME/.sandbox/sandbox.log`
290
291It is also helpful to include:
292
293- a short description of what you were trying to do,
294- whether the `elevated` sandbox failed or the `unelevated` sandbox was used,
295- any error message shown in the app,
296- whether you saw `1385` or another Windows or PowerShell error,
297- and whether you are on Windows 11 or Windows 10.
298
299Do not send:
105 300
106301### Troubleshooting and FAQ- the contents of `CODEX_HOME/.sandbox-secrets/`
107 302
108303#### Installed extension, but it’s unresponsiveThe IDE extension is installed but unresponsive
109 304
110Your system may be missing C++ development tools, which some native dependencies require:305Your system may be missing C++ development tools, which some native dependencies require:
111 306
115 310
116Then fully restart VS Code after installation.311Then fully restart VS Code after installation.
117 312
118313#### If it feels slow on large repositoriesLarge repositories feel slow in WSL
119 314
120- Make sure you’re not working under `/mnt/c`. Move the repository to WSL (for example, `~/code/…`).315- Make sure you’re not working under `/mnt/c`. Move the repository to WSL (for example, `~/code/…`).
121- Increase memory and CPU for WSL if needed; update WSL to the latest version:316- Increase memory and CPU for WSL if needed; update WSL to the latest version:
125 wsl --shutdown320 wsl --shutdown
126 ```321 ```
127 322
128323#### VS Code in WSL can’t find `codex`VS Code in WSL cannot find codex
129 324
130Verify the binary exists and is on PATH inside WSL:325Verify the binary exists and is on PATH inside WSL:
131 326