Reviewed by Jonathan West · Updated Nov 9, 2026

How to Install Codex CLI on Windows

Install with PowerShell or WSL2, and update Codex CLI by the method you used.

Reviewed by Jonathan West · Updated Nov 9, 2026

You install Codex CLI on Windows by running OpenAI's installer in a new PowerShell window. Codex CLI is OpenAI's command-line interface (CLI) coding agent that runs locally on your computer.

You can also install Codex CLI through npm, or run it inside Windows Subsystem for Linux 2 (WSL2) when you need Linux-native tooling. As of 9 November 2026, Windows 11 is OpenAI's recommended baseline. Updating means rerunning the command for the method you used.


How to Install Codex CLI on Windows

OpenAI documents a standalone installer for Windows and instructs users to start it from a new PowerShell window.

Work through these steps:

  • Open a new PowerShell window on your Windows machine.
  • Run the standalone installer command: powershell -ExecutionPolicy ByPass -c "irm https://chatgpt.com/codex/install.ps1 | iex"
  • Open a project directory in PowerShell and run codex.
  • Choose Sign in with ChatGPT or another available sign-in method when prompted in the terminal.
  • Try a first task such as "Tell me about this project" after creating a Git checkpoint so you can revert any automated changes.

Other Ways to Install Codex CLI on Windows

You can also install Codex CLI using npm. Run npm install -g @openai/codex in your terminal.

The standalone installers download from releases.openai.com by default and fall back to GitHub Releases if a metadata or asset download is unavailable. To force GitHub Releases during installation, set the environment variable CODEX_INSTALLER_USE_RELEASES_OPENAI_COM to false. Run the command in the table below in a new PowerShell window, then run the standalone installer command from the install steps above in that same window.

StepPowerShell command
Force GitHub Releases for this window$env:CODEX_INSTALLER_USE_RELEASES_OPENAI_COM='false'

Account authentication happens during your first run. OpenAI recommends signing in with a ChatGPT account to use Codex as part of a Plus, Pro, Business, Edu, or Enterprise plan. Codex also works with an API key, which requires additional manual setup through the documented authentication options.


Which Windows Versions Run Codex CLI

OpenAI recommends Windows 11, treats recent, fully updated Windows 10 as best effort, and does not recommend older Windows 10 builds in its Windows docs.

Windows versionSupport levelWhat OpenAI says
Windows 11RecommendedThe best baseline for Codex on Windows. Use it if you are standardizing an enterprise deployment.
Recent, fully updated Windows 10Best effortCan work but is less reliable than Windows 11. Codex depends on modern console support, including ConPTY, and in practice Windows 10 version 1809 or newer is required.
Older Windows 10 buildsNot recommendedMore likely to miss required console components such as ConPTY and more likely to fail in enterprise setups.

OpenAI notes that the winget package manager should be available on the host machine. If winget is missing from your system, update Windows or install Windows Package Manager before setting up Codex CLI.

The Microsoft Execution Containers (MXC) sandbox needs capabilities that Microsoft is rolling out to Windows 11 devices. Microsoft introduced MXC process isolation in Windows 11 24H2 (build 26100.9278) and Windows 11 25H2 (build 26200.9278). In Codex CLI 0.162.0 and later, you can test MXC for one command without changing your saved sandbox selection. From your project directory, run codex -c windows.sandbox=mxc sandbox --include-managed-config --permission-profile :workspace -- cmd.exe /d /c echo MXC_OK, then run $LASTEXITCODE. Expected output is MXC_OK and exit code 0.


Native Windows or WSL2 for Codex CLI

On our reading of OpenAI's Codex pages as of 9 November 2026, you should default to the native Windows installer. Choose WSL2 when you need Linux-native tooling, your repositories already live in WSL2, or the native options do not meet your needs. The CLI docs, the README and the Windows docs all describe a native Windows install. The WSL page frames WSL2 as an alternative.

RouteWhere Codex runsChoose it whenWhere OpenAI says so
Native WindowsNatively in PowerShell, inside the Windows sandboxBy defaultWindows docs
WSL2Runs inside the Linux environmentYou need Linux-native tooling, repositories live in WSL2, or native implementations do not meet your needsWSL page

The docs/install.md file, titled Installing & building, also covers building from source. Its system requirements table lists operating systems as macOS 12+, Ubuntu 20.04+/Debian 10+, or Windows 11 via WSL2, omitting any mention of native Windows installation. Among the OpenAI pages we read, it is the only one that lists WSL2 alone for Windows, and OpenAI gives no explanation for the difference.

For readers who choose WSL2 and follow the Linux install, see Codex CLI on Linux.

Once your CLI installation completes, you can add an MCP server to Codex CLI.


Windows Sandbox Options for Codex CLI

Codex supports three Windows sandbox implementations, and which one it uses depends on your device and policy.

The ChatGPT desktop app on Windows automatically prefers MXC for consumer accounts when the device supports it. For enterprise deployments or standalone CLI use, you can enable the same behavior by adding prefer_mxc = true under [features] in config.toml. With this setting configured, Codex uses MXC when the device and operating system policy support it, and otherwise falls back to the existing legacy selection and setup workflow.

The three implementations are:

  • mxc: The recommended sandbox on compatible Windows devices that uses native process isolation without administrator-approved setup, additional Windows accounts, or local firewall rules.
  • elevated: The preferred legacy fallback when MXC is unavailable or disabled, which requires administrator-approved setup and runs commands without administrator privileges.
  • unelevated: A legacy fallback when elevated setup is unavailable and organizational policy permits it, offering weaker network isolation than elevated mode and lacking support for denied read paths.

Set Up Codex CLI in WSL2

When you use WSL2, Codex runs directly inside the Linux guest environment instead of using the native Windows sandbox.

WSL1 was supported through Codex version 0.114, but starting in Codex version 0.115, the Linux sandbox moved to bubblewrap, making WSL1 unsupported.

To install in WSL2, open an elevated PowerShell or Windows Terminal and follow these steps:

  • Install the default Linux distribution, such as Ubuntu, by running wsl --install in an elevated terminal prompt.
  • Launch your Linux distribution shell by running wsl.
  • Download and execute the Linux installer script inside the WSL shell by running curl -fsSL https://chatgpt.com/codex/install.sh | sh.
  • Launch the agent inside your Linux terminal by running codex.

Working in WSL2 Without Slow Repositories

Keep your repositories under your Linux home directory, such as ~/code/my-app, instead of /mnt/c. OpenAI says working in Windows-mounted paths like /mnt/c/... can be slower than working in Windows-native paths. A Linux home directory gives faster I/O and fewer symlink and permission issues.

If you need Windows access to those files, open \\wsl$\Ubuntu\home\<user> in Windows File Explorer.

If large repositories experience performance degradation inside WSL2, verify that your project is not located under /mnt/c and relocate the files to the Linux file system under ~/code/.... You can also allocate more memory and CPU cores to your WSL instance, or refresh the subsystem by running wsl --update followed by wsl --shutdown in PowerShell.

If VS Code in WSL cannot find codex, check that the binary exists and is on your PATH inside WSL. Run which codex || echo "codex not found" in your WSL shell. If it is not found, follow the Codex CLI setup instructions for WSL.


How to Update Codex CLI on Windows

You update Codex CLI by rerunning the installation command associated with the method you originally used to install the software. The official Codex CLI documentation lists an update command for each install method.

Install methodUpdate commandWhere OpenAI says so
Windows PowerShell installerRerun the installer command from a new PowerShell windowCodex CLI docs page
npmnpm install -g @openai/codexCodex CLI docs page
Homebrewbrew upgrade --cask codexCodex CLI docs page
macOS and Linux installerRerun the installer commandCodex CLI docs page

On our reading of the CLI documentation, WSL2 installs use the macOS and Linux installer. The matching update is the same installer command, rerun inside the WSL shell.

An OpenAI Developer Community thread titled "Codex CLI on Windows update fails" began on 20 May 2026. It has user posts through 10 September 2026. In the opening post, a user said Codex CLI shows a three-item startup menu on Windows when an update is available. Selecting the in-app update failed, the poster wrote, because Codex runs the update from its own sandbox and hits a permission wall. The poster's advice was to close the terminal, open a new session and run the displayed update command.

The same poster later wrote that running npm install -g @openai/codex in PowerShell was the only way to make the update work for them. On 23 July 2026, the original poster tried the in-app update again. It ran npm install -g @openai/codex and printed an EPERM cleanup warning about removing some directories. It ended by saying the update ran successfully and asking for a restart of Codex. On 9 September 2026, an account named OpenAI_Support replied that the npm update command is documented on the Codex CLI docs page. It said the latest log reports success alongside a cleanup warning, and that checking the version after restart would help confirm the result. It also said it would pass along the request to keep the copyable command visible. No timeline was given.

OpenAI's CLI docs, read on 9 November 2026, say nothing about why a Windows update fails or whether Codex updates itself automatically. Combining the docs and the thread gives a practical sequence. Close running Codex sessions, open a fresh PowerShell window, run the update command for your install method, and restart Codex.


Fixing Windows Setup Problems

When sandboxed commands fail with error 1385, Windows is denying the logon type the sandbox user needs in order to start the command. OpenAI says this usually means Codex created the sandbox users successfully, but Windows policy is still preventing those users from launching sandboxed commands. Ask your information technology (IT) team whether device policy grants the required logon rights to the Codex-created sandbox users. If only some machines or teams are affected, compare Group Policy or Organizational Unit (OU) differences. To keep working in the meantime, you can use the unelevated sandbox while IT investigates the policy.

If the legacy elevated sandbox setup fails, OpenAI says common causes include a declined Windows User Account Control (UAC) or administrator prompt. The machine may also block local user or group creation, firewall rule changes or the logon rights the sandbox users need. Another enterprise policy can block part of the setup. Try the elevated setup again and approve the administrator prompt if your environment allows it. On a company laptop, ask your IT team. If setup still fails and managed policy permits it, use unelevated while the issue is investigated.

Codex may generate a warning indicating that specific folders are writable by Everyone. This alert indicates that Windows file access permissions on those folders are too broad for sandbox boundaries to restrict access effectively. Review the flagged directories, remove write permissions for the Everyone group if appropriate for your workflow, and restart Codex or re-run sandbox setup.

When a sandboxed command cannot read a required directory, review the active permission profile, managed system policies, and Windows file permissions. Inside the CLI interface, run /status and /debug-config to inspect active session permissions and configuration flags. Request an administrative policy review rather than disabling the sandbox completely.

If you submit an issue report to OpenAI regarding sandbox failures, provide the log file located at CODEX_HOME/.sandbox/sandbox.log. Include your Windows build number, OS edition (Windows 11 or Windows 10), selected sandbox mode (mxc, elevated, or unelevated), error messages, and whether error 1385 appeared. Do not send the contents of CODEX_HOME/.sandbox-secrets/.

In corporate environments where users lack local administrative privileges, IT administrators can provision the elevated sandbox in advance. An administrator can execute codex sandbox setup --elevated --user 'DOMAIN\alice' --codex-home 'C:\Users\alice\.codex' from an elevated deployment task. The employee then runs Codex from a normal terminal.

OpenAI says to choose WSL2 when the available native Windows implementations do not meet your needs.


Our Takeaway for Codex CLI on Windows

On our reading of OpenAI's Codex pages as of 9 November 2026, you should run OpenAI's PowerShell installer first. Choose WSL2 when you need Linux-native tooling, your repositories already live in WSL2, or the native options do not meet your needs.

This guidance does not suit readers who want a graphical app. They can use the ChatGPT desktop app on Windows or run codex app. It also does not suit managed devices where IT blocks the setup steps. In that case, ask IT, use unelevated only if policy permits it, or use WSL2.

Changes to OpenAI's installation documentation or updates to the docs/install.md file in the openai/codex repository would modify our assessment of these deployment paths.

To begin, open a new PowerShell window and run the standalone installer to start using Codex CLI on Windows.

Frequently Asked Questions

  • You install Codex CLI on Windows by opening a new PowerShell window and running the standalone installer command powershell -ExecutionPolicy ByPass -c "irm https://chatgpt.com/codex/install.ps1 | iex". After installation, launch your project directory and run codex to sign in with your account. Users can alternatively install using npm install -g @openai/codex.
  • Open PowerShell and execute powershell -ExecutionPolicy ByPass -c "irm https://chatgpt.com/codex/install.ps1 | iex" to run the official installation script. To force GitHub Releases, set the environment variable CODEX_INSTALLER_USE_RELEASES_OPENAI_COM to false in that PowerShell window, then run the same installer command again.
  • Codex CLI runs as a command-line coding agent directly inside your terminal. The openai/codex repository README also distinguishes the CLI from the desktop application accessible via codex app, the IDE extension, and Codex Web at chatgpt.com/codex.
  • Run the standalone installer command in PowerShell, open your project folder, and enter codex. Sign in with your ChatGPT account, or set up an API key. Make a Git checkpoint so you can revert changes, then try a prompt such as "Tell me about this project".
  • Run brew upgrade --cask codex in your terminal to update the package. OpenAI lists this command on the official Codex CLI documentation page alongside standard upgrade instructions.
  • Official documentation captured on 9 November 2026 does not state whether Codex CLI updates automatically. A community forum post from May 2026 reported that the terminal displayed a startup menu offering an update option, so treat automatic updating as not documented.

Rolling Out Codex CLI to a Windows Team?

Layer3 Labs offers an AI workflow audit for small and mid-sized businesses. Book a consultation to talk through where coding agents fit your team's work.

Book a Consultation