How to install Codex CLI on Mac, Windows and Linux

One installer command per system, then sign in with ChatGPT or an API key. Plus how to check the install, keep it updated and track usage from day one.

By ClaudeGPT Si Newsroom, Editorial team

3 min read

How to install Codex CLI: run OpenAI's one-line installer for your system, then type codex in a project folder and sign in. On macOS and Linux that is a curl command, on Windows a PowerShell command, and npm or Homebrew work too if you already manage tools that way.

The steps below follow the openai/codex README and OpenAI's CLI docs, checked on November 3, 2026. The newest release at that point was 0.166.0, published on October 29.

Before you start

You need a terminal, a project folder and a way to pay for model time. As of November 2026, OpenAI lists Codex CLI on the ChatGPT Plus plan ($20 a month), Pro, Business and Enterprise. You can also skip the plan and use an OpenAI API key billed per token.

Install on macOS or Linux

Run the standalone installer:

curl -fsSL https://chatgpt.com/codex/install.sh | sh

It downloads from OpenAI's release server and falls back to GitHub Releases if that server is unavailable. Homebrew users can run this instead:

brew install --cask codex

There is also a manual route. The latest GitHub Release carries builds for Apple Silicon and Intel Macs and for x86_64 and arm64 Linux. Extract the archive, rename the file inside to codex and put it somewhere on your PATH.

Install on Windows

Open PowerShell and run:

powershell -ExecutionPolicy ByPass -c "irm https://chatgpt.com/codex/install.ps1 | iex"

Codex runs natively on Windows with its own sandbox, so you do not need WSL or a virtual machine. On devices that support Microsoft's MXC isolation, which arrived with recent Windows 11 builds, OpenAI recommends that sandbox. Otherwise Codex falls back to its elevated sandbox, which needs a one-time setup approved by an administrator; /setup-default-sandbox starts that setup from inside a session.

Install with npm

If Node.js is already part of your setup, one command does it:

npm install -g @openai/codex

That suits machines where you keep every CLI under npm, and it is easy to script in a dev container.

Sign in

Open a project folder and run codex. The first time, choose Sign in with ChatGPT and finish the flow in your browser. On a machine without a browser, codex login also supports device authentication.

To use an API key instead, pipe it in:

printenv OPENAI_API_KEY | codex login --with-api-key

codex login status tells you which method is active. Credentials are cached in ~/.codex/auth.json or your system's credential store. OpenAI says to treat that file like a password, so keep it out of Git and out of support tickets.

Check that it works

In the session, type /status. It confirms the model, approval policy and folders Codex is allowed to write to. Then ask for something harmless, such as a summary of the project, before you let it change code.

If something is off, codex doctor writes a diagnostic report that covers the install, config, sign-in, Git, terminal and the background server.

Keep it updated

codex update checks for a newer release and applies it when your install supports self-update. Running the installer again also updates it. If you installed with npm or Homebrew, update through those tools.

Add usage tracking while you are at it

Once Codex runs, the next question is usually how much of the plan a session used. Inside the CLI, /status and /usage answer that for the moment. For the longer view, the tool we suggest installing next is UsageAtlas, a free, open-source desktop tracker for Windows, macOS and Linux. It picks up the Codex CLI you just signed in to on the same computer and shows session and weekly windows, reset times, tokens by model, an estimated cost and history, with an alert before a window runs out. It needs no account for local tracking and does not read your prompts.

If you only open Codex now and then, the built-in commands are enough and you can skip the extra app.