AI Income LabJoin AI Income Lab ↗

Build guide · By · Published · Updated

Codex CLI install: Mac, Windows and Linux

Diagram for the Codex CLI guide: install with the official installer, npm or Homebrew, sign in with ChatGPT, then run codex in a project folder.
Install the CLI → Sign in with ChatGPT → Run codex in a project

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 methodInstall 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
Homebrewbrew 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:

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:

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

Done when

Watch the walkthrough

Watch on YouTube: I Tried The New Codex CLI... Here Is What Happened. Also on this site with notes: the watch page.

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.

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

See every tool I recommend →

Written by . I’ve shipped software since 2013 and test AI tools on real builds for the AI Automation Station YouTube channel. Each guide shows the date it was last updated and lists the sources it relies on.

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.

Join AI Income Lab ↗From $29/month. Cancel anytime.
Join 2,900+ members building with AI

Not ready to join? Get the weekly build notes: new guides and tested builds in one short email.