# 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.

URL: https://claudegpt.si/news/how-to-install-codex-cli-mac-windows-linux  
Published: 2026-11-03T16:12:34.156Z  
Author: ClaudeGPT Si Newsroom  
Section: Guides  
Topics: Codex CLI, OpenAI, Developer tools  
Publisher: ClaudeGPT Si

## Key takeaways

- On macOS and Linux, OpenAI's curl installer sets up Codex CLI; on Windows, a PowerShell installer does the same, and npm or Homebrew also work.
- After installing, run codex in a project folder and sign in with ChatGPT, or pipe an API key to codex login --with-api-key.
- codex doctor diagnoses a broken setup, codex update keeps it current, and UsageAtlas can track usage from the same signed-in CLI.

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](https://github.com/openai/codex) and [OpenAI's CLI docs](https://developers.openai.com/codex/cli), 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](https://usageatlas.com/), 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.

## Frequently asked questions

### Do I need Node.js to install Codex CLI?

No. The standalone installers for macOS, Linux and Windows download a ready-built release. npm is just one of the install options.

### Does Codex CLI need WSL on Windows?

No. Codex runs natively on Windows in PowerShell with its own sandbox, so neither WSL nor a virtual machine is required.

### How do I update Codex CLI?

Run codex update, which applies a new release where self-update is supported, or run the installer again. If you used npm or Homebrew, update through that tool.

## Sources

- [openai/codex README](https://github.com/openai/codex), OpenAI on GitHub
- [Codex CLI quickstart](https://developers.openai.com/codex/cli), OpenAI
- [Codex authentication](https://developers.openai.com/codex/auth), OpenAI
- [Windows sandbox](https://developers.openai.com/codex/windows), OpenAI
- [Developer commands](https://developers.openai.com/codex/cli/slash-commands), OpenAI
- [UsageAtlas](https://usageatlas.com/), UsageAtlas
