Installing Codex CLI on Mac: One Command Is All It Takes
Have you searched "install codex" before? The results come back in two flavors. One is the cloud version at chatgpt.com/codex, which runs entirely in your browser (Codex Web). The other is Codex CLI, which you install on your own machine. This guide covers the second one, installing Codex CLI on a Mac. Here's the short version: one line in the terminal is all it takes.
curl -fsSL https://chatgpt.com/codex/install.sh | shIf you have never opened a terminal before, that's fine. This guide is built to be followed step by step: opening the terminal, 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 your terminal. It reads, organizes, and edits files directly on your computer.
What you need: an account and macOS 12 or later
Three things: your regular ChatGPT account, a Mac running macOS 12 or later, and 4GB of memory or more (8GB recommended). If your Mac is from the last few years, memory isn't something you need to worry about.
Let's start with pricing, since it matters here. The official pricing page states in prose that Codex is included on every ChatGPT plan, including Free. The Free plan is described as a way to "sample Codex with quick coding tasks."
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. Having access to Codex and being able to run it from a terminal aren't the same claim.
The docs don't explicitly say whether CLI sign-in is blocked on the free plan. Since installing is one command and easy to undo, trying it yourself is faster than reading further. If it turns out to be blocked, Plus is the clear entry point where the CLI is confirmed in the feature table.
If you're on Windows, the install command is different. That gets its own guide.
Step 1: open the terminal
Press Command and the space bar together to open Spotlight search. Type "Terminal" and hit Enter. You can also find Terminal inside the Utilities folder within Applications.
Success looks like this: a white (or black) window appears with a blinking cursor. That window is your workspace for the rest of this guide. If you're curious about what a terminal actually is, you can set that aside for now: this guide only asks you to open the window and paste commands into it. If you want to build up terminal basics from scratch, there is a separate terminal setup lesson for that.
Step 2: run the install command
Copy the line below exactly, paste it into the terminal window, and hit Enter.
curl -fsSL https://chatgpt.com/codex/install.sh | shThis one line does exactly one thing: it downloads and runs OpenAI's official install script. The script pulls Codex itself into a ~/.codex folder, and registers its location in your shell configuration (adding it to your PATH) so that typing codex works from any window. It's like ordering furniture and having the delivery crew assemble it for you before they leave.
Success looks like this: a handful of lines starting with ==> scroll by. There's no progress bar, so it's normal for the screen to go quiet for a moment. After that, you'll see a completion message like Codex CLI 0.149.0 installed successfully. followed by Start Codex now? [y/N], and you can just press Enter to skip past it. You'll open a fresh window to confirm the install in the next step. No icon appears in the Dock or Launchpad either, and that's expected, not a bug.
Step 3: confirm the install in a new window
Close the terminal window you have open, 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.149.0
That output is from my own Mac, checked while writing this guide. The version number will differ depending on when you install. As of this writing (August 21, 2026), the latest version was 0.149.0. The number doesn't matter; as long as you see codex-cli in the output, the install worked.
Step 4: sign in with your ChatGPT account
In the same window, type just this:
codexWhen it asks you to choose a sign-in method, pick Sign in with ChatGPT. Your browser opens automatically. Sign in with your usual ChatGPT account, and the flow hands control back to the terminal window. 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 the terminal.
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
If Codex reads the folder and gives you an organized answer, you're done for today. When you want to update later, codex update is all it takes. If you want to build up your terminal fundamentals from the ground up, the AI CLI track covers it across six lessons.
Fixing "command not found" and duplicate installs
You typed codex and got "command not found." This is almost always a window issue. The registration only takes effect in windows opened after the install, so the window you used during install won't recognize it. Close the terminal completely and open a new one. If you're in a hurry, you can also run this in your current window to fix it immediately:
export PATH="$HOME/.local/bin:$PATH"
codexLooks like Codex got installed twice. If you previously installed Codex through a development tool like npm or Homebrew, and then installed it again with this guide's method, you now have two codex commands with the same name. Whichever one comes first in your PATH is the one that runs. The install script itself flags this situation and warns you it's ambiguous which one will execute. Run which codex to see which one is currently active. It's safer to keep just one and remove the other. 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.
- Searching "install codex" turns up both the cloud version (Codex Web) and Codex CLI. The one you install on your own machine is Codex CLI.
- Installing on Mac takes one line in the terminal:
curl -fsSL https://chatgpt.com/codex/install.sh | sh. It handles both the file install and PATH registration. You need macOS 12 or later and at least 4GB of memory. - Five steps: open the terminal, run the install command, confirm with
codex --versionin a new window, runcodexand sign in with ChatGPT, 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 "command not found" right after installing, opening a fresh terminal window is the first fix. Registration only takes effect in new windows.
- Update with
codex update, and check status withcodex doctor.
Frequently asked questions
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.
I installed codex but I'm getting command not found. Why?
The install succeeded, but the terminal window you currently have open doesn't yet know where the program is (PATH). PATH registration only takes effect in windows opened after the install. Close the terminal completely and try again in a new window. If that doesn't fix it, add ~/.local/bin to your PATH directly with an export command.
Other guides say to use npm or Homebrew instead. Why?
You can install via npm (npm install -g @openai/codex) or Homebrew (brew install --cask codex) as well, and the result is the same. But both require installing a separate development tool first, so for a first install, this guide's one-line official script is the easier path. If you end up with both installed at once, it becomes ambiguous which one runs, so it's safer to stick to just one method.
How do I update Codex CLI?
Run codex update in the terminal to move to the latest version. Re-running the official install script does the same thing. If you installed via npm, update with npm install -g @openai/codex@latest instead.
The terminal seems intimidating. Do I really need to use it?
No, you can also use Codex through the ChatGPT desktop app without installing the CLI separately. That said, codex exec, which lets you run Codex automatically from scripts or CI, is only available through the terminal version. And since the app also works directly with your local files and projects, you'll still need development tools like Git set up on your Mac either way.
How do I install Codex CLI on Windows?
On Windows, run powershell -ExecutionPolicy ByPass -c "irm https://chatgpt.com/codex/install.ps1 | iex" from PowerShell. Since the commands differ from Mac, Windows users should follow a Windows-specific guide.
Sources (7)Expand to see all sources
- OpenAI Codex Docs, "Codex CLI", install commands and getting started (checked 2026-08-21)
- OpenAI Codex Docs, "Authentication", ChatGPT sign-in method (checked 2026-08-21)
- OpenAI Codex Docs, "Pricing", feature table by plan, showing Codex CLI on Plus and above with Free and Go excluded (rechecked 2026-09-07)
- GitHub, openai/codex README, install methods and the Codex Web distinction (checked 2026-08-21)
- GitHub, openai/codex docs/install.md, system requirements (checked 2026-08-21)
- GitHub, openai/codex Releases, rust-v0.149.0 (released 2026-08-20, checked 2026-08-21)
- OpenAI, Codex install script source, install path and PATH registration behavior (checked 2026-08-21)