Installing Codex CLI on Windows: One PowerShell Line Is All It Takes
Have you searched "install codex windows" before? The results come back split. Some posts say to install WSL (Windows Subsystem for Linux) first, others say it just works. Here's the short version: it works without WSL now. One line in PowerShell is all it takes.
powershell -ExecutionPolicy ByPass -c "irm https://chatgpt.com/codex/install.ps1 | iex"If you have never opened PowerShell before, that's fine. This guide is built to be followed step by step: opening PowerShell, running the install command, confirming it worked, signing in, and giving Codex its first task.
Each step tells you what success looks like, so you can compare it against your own screen as you go. Install commands can go stale quickly, so if you get stuck, check the official docs as a second reference.
- Codex CLI
Codex CLI is OpenAI's AI tool that takes instructions in plain language from a command-line window. It reads, organizes, and edits files directly on your computer.
What you need: an account and Windows 11
Two things: your regular ChatGPT account, and a Windows version check.
The official pricing page states that Codex is included on every ChatGPT plan, including Free.
The terminal-based Codex CLI is a different story, though. In the same document's feature table, the CLI is only listed starting from the Plus plan, and the Free and Go cards don't list it at all. Since the install is one command and easy to undo, signing in yourself is faster than reading further. If it turns out to be blocked, Plus is the confirmed entry point in the feature table.
The official docs recommend Windows 11. If you're on Windows 10, get the latest updates installed first.
If you're on a Mac, the install command is different. That's covered in a separate Mac guide.
Step 1: open PowerShell
Right-click the Start button and choose Terminal. On Windows 10, type PowerShell into the Start menu search box and launch Windows PowerShell instead.
Success looks like this: a black (or blue) window opens, and the first line starts with PS. This window is your workspace for today.
Step 2: run the install command
Copy the line below exactly, paste it into the PowerShell window, and hit Enter.
powershell -ExecutionPolicy ByPass -c "irm https://chatgpt.com/codex/install.ps1 | iex"You're already inside PowerShell, and the command starts with powershell again anyway. The first part just allows script execution for this one install run, it doesn't change any system-wide setting.
Everything after that does one thing: it downloads and runs OpenAI's official install script. The script drops the codex executable into a set folder (%LOCALAPPDATA%\Programs\OpenAI\Codex\bin) and registers that location with your account (adds it to PATH). It's like moving house and having the crew file your address change on top of carrying the boxes.
Success looks like this: a handful of lines starting with ==> scroll by, followed by a completion message like Codex CLI 0.153.4 installed successfully.
There's no progress bar, so it's normal for the screen to go quiet for a moment. Next you'll be asked Start Codex now? [y/N]:, just press Enter to skip past it. You'll open a new window to confirm the install in the next step.
No icon appears on the desktop either. It's a terminal-only tool, so there never was one to begin with.
If the install stalls here, or antivirus throws a warning, jump to the "If you get stuck" section below.
Step 3: confirm the install in a new window
Close the PowerShell window you have open entirely, then open a fresh one the same way as Step 1. The registration you just set up only takes effect in windows opened after the install. In the new window, type:
codex --versionSuccess looks like this:
codex-cli 0.153.4
The version number will differ depending on when you install. What matters more than the number is seeing codex-cli in the output at all. If that shows up, the install worked.
Step 4: sign in with your ChatGPT account
In the same window, type just this:
codexA sign-in method screen appears. You can't click here with a mouse. Use the up and down arrow keys to move the cursor to Sign in with ChatGPT, then press Enter.
Your browser opens automatically. Sign in with your usual ChatGPT account, and the flow hands control back to PowerShell. You only need to sign in once. After that, the session is remembered on your machine.
Success looks like this: Codex's chat prompt appears inside PowerShell.
Step 5: give it one task
Type plain language into the prompt, not code. Try something like:
List the files in this folder for me
Codex reads whichever folder the current window is pointed to. If you didn't pick one, that's usually your user folder.
Success looks like this: a list of file names appears, followed by a short description of what each one is. If you got that far, you're done for today.
When you want to update later, codex update is all it takes. If you want to build up your PowerShell fundamentals from the ground up, the AI CLI track covers it across six lessons.
If you get stuck: "is not recognized," execution policy, and antivirus
Find the line that matches what's on your screen and read just that entry.
You typed codex and got "is not recognized." Almost always a window issue. Registration only takes effect in windows opened after the install, so the window you used during install won't recognize it. Close PowerShell completely and open a new one to try again.
"running scripts is disabled on this system." You won't hit this if you installed with this guide's official script. It shows up on machines that previously had Codex installed through npm, a separate developer tool.
Run Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser to fix it, then reinstall using this guide's command if you like.
Antivirus blocks the install. An issue in the developer's official repo documents a McAfee case where the install script was flagged and quarantined as fileless malware. The same repo also has reports of Norton and Bitdefender blocking PowerShell while Codex was running.
On a personal PC, turn off real-time scanning briefly in your antivirus settings, install, then turn it back on. On a work PC, you'll need to ask IT for an exception.
The property 'OSArchitecture' cannot be found on this object. This hits the step where the script checks your CPU architecture, and it's specific to PowerShell 5.1, the version that ships by default on Windows 10. A separate issue in the same repo documents it, and it hasn't been patched in the script yet.
The fix is PowerShell 7, a different program from the one you opened in Step 1, so you'll need to install it separately. Open Microsoft Store from the Start menu, search for PowerShell, and install it. Once that's done, open PowerShell 7 from the Start menu and run the same install command there. Some users report that clears it.
Looks like it installed twice. If you previously installed Codex through npm and then installed it again with this guide's method, you now have two codex commands with the same name. Run Get-Command codex to see which one is currently active. It's safer to keep just one. To remove the npm one, run npm uninstall -g @openai/codex.
Not sure what's wrong? Run codex doctor to check your install, configuration, and sign-in status.
- Codex CLI now installs on Windows without WSL. The official docs recommend Windows 11.
- Installing takes one PowerShell line:
powershell -ExecutionPolicy ByPass -c "irm https://chatgpt.com/codex/install.ps1 | iex". It handles both the file install and PATH registration. - Five steps: open PowerShell, run the install command, confirm with
codex --versionin a new window, runcodexand sign in with ChatGPT (arrow keys, then Enter, since you can't click this screen), then give it a first task. - The official docs state that Codex is included on every ChatGPT plan, including Free. But the terminal-based CLI is only listed in the feature table starting from Plus, and doesn't appear on the Free or Go cards.
- If you see "is not recognized" right after installing, opening a fresh PowerShell window is the first fix. Registration only takes effect in new windows.
- Update with
codex update, and check status withcodex doctor.
Frequently asked questions
Do I need WSL to use Codex CLI on Windows?
No. Codex CLI runs natively on top of PowerShell. WSL2 is an option worth choosing if you specifically need Linux-only tools or you're already working inside WSL. Note that WSL1 support has ended, so if you do go the WSL route, it needs to be WSL2.
Is Codex CLI free to use?
Codex itself is included on the free plan, but the terminal-based Codex CLI is different. The official feature table only lists the CLI starting from the Plus plan, and it doesn't appear on the Free or Go cards. Since the install is one command, trying to sign in yourself is faster than reading further, and if you get blocked, Plus is the confirmed entry point. There's also a way to use the CLI with an API key instead of a subscription.
Other guides say to use npm instead. Why?
You can also install it with npm (npm install -g @openai/codex). The result is the same, but you need to install npm, a separate developer tool, first, and you may run into an execution policy error. For a first install, this guide's official one-line script is the easier path. Installing both at once makes it ambiguous which one runs, so stick to one method.
I installed codex, but I'm getting 'is not recognized.' Why?
The install itself worked, but the window you have open right now doesn't yet know where the program lives (PATH). PATH registration only takes effect in windows opened after the install, so close PowerShell completely and try again in a new window. Install location: %LOCALAPPDATA%\Programs\OpenAI\Codex\bin.
How do I install Codex CLI on a Mac?
On a Mac, run curl -fsSL https://chatgpt.com/codex/install.sh | sh from the terminal. Since the commands differ from Windows, Mac users should follow a Mac-specific guide.
Sources (8)Expand to see all sources
- OpenAI Codex Docs, "Codex CLI", install commands and getting started (checked 2026-09-08)
- OpenAI Codex Docs, "Windows sandbox", native execution and recommended Windows version (checked 2026-09-08)
- OpenAI Codex Docs, "WSL", when to choose WSL2 and the end of WSL1 support (checked 2026-09-08)
- OpenAI Codex Docs, "Authentication", ChatGPT sign-in method (checked 2026-09-08)
- OpenAI Codex Docs, "Pricing", feature availability by plan (checked 2026-09-08)
- GitHub, openai/codex README, Windows install command (checked 2026-09-08)
- OpenAI, Codex Windows install script install.ps1 source, install path and PATH registration behavior (checked 2026-09-08)
- GitHub, openai/codex Releases, rust-v0.153.4 (released 2026-09-04, checked 2026-09-08)