Codex CLI install: Mac, Windows and Linux

Quick answer
Codex CLI is OpenAI’s coding agent for the terminal. On Mac or Linux, install it with curl -fsSL https://chatgpt.com/codex/install.sh | sh. On Windows, use the PowerShell installer below. npm (npm install -g @openai/codex) and Homebrew also work. Then run codex in a project folder and choose Sign in with ChatGPT.
Commands on this page come from OpenAI’s Codex README and CLI quickstart, checked November 13, 2026. Run one install method, not all of them. On Linux and want the desktop app too? Codex on Linux covers the Linux desktop preview, release binaries and distribution packages in more detail.
1. Install Codex CLI: the commands for each system
Pick the row for your system. The npm package is @openai/codex and the command it installs is codex, which is why people also search for “codex-cli”.
| System or method | Install command |
|---|---|
| Mac or Linux (official installer) | curl -fsSL https://chatgpt.com/codex/install.sh | sh |
| Windows (official installer, PowerShell) | powershell -ExecutionPolicy ByPass -c "irm https://chatgpt.com/codex/install.ps1 | iex" |
| npm (any system with Node.js) | npm install -g @openai/codex |
| Homebrew | brew install --cask codex |
The standalone installers download from OpenAI’s release server and fall back to GitHub Releases if that download is unavailable, according to the README. You can also download a binary from the latest GitHub release: codex-aarch64-apple-darwin.tar.gz for Apple silicon Macs, codex-x86_64-apple-darwin.tar.gz for older Intel Macs, and codex-x86_64-unknown-linux-musl.tar.gz or codex-aarch64-unknown-linux-musl.tar.gz for Linux. Each archive holds one file with the platform in its name, so rename it to codex after extracting.
Read a script before you pipe it to your shell if you want to see what it runs. That applies to both installer commands.
2. Run codex and sign in
Open the project folder you want to work in and run:
codex
The first time, choose Sign in with ChatGPT, or another sign-in method shown. OpenAI recommends the ChatGPT sign-in so Codex uses your ChatGPT plan. An API key also works but needs extra setup. Limits depend on your plan; Codex usage limits explains how to check what is left and when it resets.
On a remote machine with no browser, OpenAI documents device-code login, labelled beta. Turn it on in your security settings, or ask your workspace admin, then run:
codex login --device-auth
Open the link it prints in any browser and enter the one-time code.
3. Your first task
Start in a Git repository and describe one task, for example “Tell me about this project”. OpenAI’s quickstart suggests a Git checkpoint before and after each task so you can revert changes. The start screen lists a few commands worth knowing:
/initcreates anAGENTS.mdfile with instructions for Codex./statusshows the current session settings./permissionschooses what Codex is allowed to do./modelpicks the model and reasoning effort./reviewreviews your changes and looks for issues.
For scripts and CI, the quickstart points to codex exec. For a full worked example with a reviewed diff, follow the Codex workflow guide.
4. Update Codex CLI
OpenAI documents the same installer command for updates, so on Mac or Linux run curl -fsSL https://chatgpt.com/codex/install.sh | sh again. If you installed with a package manager, update through it: with npm, install the package again (npm install -g @openai/codex@latest); with Homebrew, run brew upgrade --cask codex. Keep a note of which method you used, because two installs can leave two copies of codex on your system.
5. What the walkthrough shows
In my May 2026 walkthrough I use Codex in the terminal and in Codex Cloud after switching from Claude Code. The install itself was already done, so the video starts at sign-in. It shows:
- signing in with a ChatGPT Plus account,
- a code review run in Codex Cloud against a connected GitHub repository,
- choosing a smaller model at medium reasoning to save credits, as stated at the time,
- a local review, a fix to a newsletter form, then a commit and push,
codex resumeto pick up an interrupted session.
I start Codex in a mode that skips approvals in that video. That lets the agent edit files and run commands without asking, so leave approvals on until you trust your setup. For Claude Code and Codex side by side, see Codex vs Claude Code.
6. If codex is not found or sign-in fails
- “command not found”: open a new terminal so it picks up the updated path, then try again. If it still fails, check where your install method put the binary.
- Two versions: run
codex --versionafter an update. If the number did not change, another install is earlier on your path. - Sign-in never finishes on a server: use
codex login --device-authinstead of the browser flow. - Out of usage: that is a plan limit, not an install problem. See Codex usage limits.
Done when
- You finished the steps in this guide.
- You checked current prices on the vendor page where this guide quotes them.
- You know what this walkthrough did not cover.
Watch the walkthrough

- 0:00 Codex CLI Overview
- 0:42 What Codex Does
- 1:18 Setup Requirements
- 2:05 Install Codex CLI
- 2:52 Sign In to ChatGPT
- 3:40 Open Your Project
- 4:28 Run Your First Prompt
- 5:25 Let Codex Edit Files
- 6:35 Review Code Changes
- 7:45 Final Tips & Workflow
From the video
Lines from the video's transcript that this guide does not cover, lightly trimmed. Each time opens the video at that point. Read the full transcript.
- 4:29
You really can't go wrong with medium, but you could also set high or extra high if you're doing really intense coding work. For most cases, I find that medium works perfectly fine.
- 6:15
One of the things that I really, really like about Codex is that it's super super fast. I would say, you know, substantially faster than Claude Code.
- 8:12
This is all running inside the cloud. So you don't have to run this locally on your computer.
FAQ
What is the Codex CLI install command?
On Mac or Linux: curl -fsSL https://chatgpt.com/codex/install.sh | sh. On Windows, run the PowerShell installer from OpenAI’s README. npm install -g @openai/codex and brew install --cask codex also work.
Is it called codex-cli or @openai/codex?
The npm package is @openai/codex and the command is codex. Codex CLI and codex-cli are just names for the same terminal tool.
Does Codex CLI work on Windows?
Yes. OpenAI’s README gives a PowerShell installer for Windows alongside the Mac and Linux installer.
How do I update Codex CLI?
Run the official installer again, which OpenAI documents for updates. With npm, install @openai/codex@latest; with Homebrew, run brew upgrade --cask codex.
Do I need an API key?
No. Run codex and choose Sign in with ChatGPT to use your ChatGPT plan. An API key is an alternative that needs extra setup.
Sources
- OpenAI, Codex README: github.com/openai/codex
- OpenAI, Codex CLI quickstart: developers.openai.com/codex/cli
- OpenAI, Codex authentication: developers.openai.com/codex/auth
- Video: I Tried The New Codex CLI... Here Is What Happened (May 2026)
Build the next one with AI Income Lab
Step-by-step courses, reusable templates, and a community that answers when you get stuck.
Members get the Claude Code & Skills and Codex Tutorials & Courses lessons.
- Courses for builds like this one
- Copy-ready templates
- Ask questions while you build
- Weekly coaching on VIP