1. Hypervibe
  2. Guides
  3. Install Codex CLI on Mac with Homebrew

How to install Codex CLI on Mac (Homebrew)

OpenAI's Codex CLI installs on a Mac with a single Homebrew command. This guide walks through that command, the first sign-in with your ChatGPT plan, updating and removing it, the errors a leftover npm install causes, and the other official install methods in case you do not use Homebrew.

Before you start

  • macOS 12 or later with at least 4 GB of RAM; Codex's own docs recommend 8. Apple Silicon and Intel both have a build.
  • Homebrew. Check with brew --version. If the command is not found, install Homebrew from brew.sh first.
  • A way to sign in: a ChatGPT Plus, Pro, Business, Edu or Enterprise plan, or an OpenAI API key.
  • Git is optional and recommended. Node.js is not needed for the Homebrew install.

Install Codex CLI with Homebrew

One line in Terminal installs it, and a second confirms it:

brew install --cask codex
codex --version
# prints something like: codex-cli 0.162.1

Codex is a Homebrew cask, not a formula, which is why the command in the Codex README carries --cask. Here is what that one line does:

  • Downloads the release for your chip, Apple Silicon or Intel, from the Codex releases on GitHub.
  • Links the binary into Homebrew's bin folder: /opt/homebrew/bin/codex on Apple Silicon, /usr/local/bin/codex on Intel.
  • Sets up shell completions for zsh, bash and fish.

To see which version Homebrew would install before you run it, use brew info --cask codex.

First run: sign in with ChatGPT

cd ~/code/shop
codex

On the first run, choose Sign in with ChatGPT and finish in the browser. Codex then runs as part of the ChatGPT plan you already pay for: Plus, Pro, Business, Edu or Enterprise.

Three commands cover the rest of the account handling:

codex login status       # are you signed in?
codex logout             # remove the stored credentials
# sign in with an API key instead:
printenv OPENAI_API_KEY | codex login --with-api-key

The API key path needs additional setup that OpenAI documents separately; with a ChatGPT plan you can skip it. Codex keeps its configuration in ~/.codex/config.toml and the rest of its state, including your sign-in, in the same ~/.codex folder.

Update and uninstall

brew upgrade --cask codex        # update
brew uninstall --cask codex      # remove

Codex also has its own codex update command; on a Homebrew install it runs that same brew upgrade for you. The cask can trail a new Codex release for a while, so a version announced today may take a little to arrive through brew.

Uninstalling removes the binary and leaves ~/.codex alone. Delete that folder yourself if you also want the configuration, sign-in and history gone.

Fix the errors a second install causes

It seems there is already a Binary at '/opt/homebrew/bin/codex'

Homebrew stops with this message when another codex already sits where it wants to link. One way to get there is an earlier npm install: when Node itself came from Homebrew, npm's global folder is Homebrew's, so both installs want the same path. Remove the npm copy and install again:

npm uninstall -g @openai/codex
brew install --cask codex

The version does not change after an upgrade

Two installs again, and the shell runs the other one. Ask which codex it finds and where that file really lives:

which -a codex
ls -l "$(which codex)"

A link into node_modules/@openai/codex is the npm install; one into Caskroom/codex is Homebrew's. Keep one.

zsh: command not found: codex

Open a new Terminal window, or run rehash, so zsh picks up the new command. If brew is not found either, Homebrew's folder is missing from your PATH. On Apple Silicon this adds it; on an Intel Mac the path is /usr/local/bin/brew:

echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"

For anything else, codex doctor checks the installation, configuration, sign-in and runtime.

Without Homebrew: the other official installs

# OpenAI's installer script, Mac and Linux
curl -fsSL https://chatgpt.com/codex/install.sh | sh
# or npm
npm install -g @openai/codex

There is also a plain binary on the latest GitHub release: codex-aarch64-apple-darwin.tar.gz for Apple Silicon and codex-x86_64-apple-darwin.tar.gz for Intel. The archive holds a single file with the platform in its name, so rename it to codex and move it to a folder on your PATH.

Pick one method and stay with it. Two installs are how the errors above start.

After the install: Codex next to your other agents

Codex does not have to be the only agent on your Mac. If Claude Code or Gemini CLI is installed as well, you now have several terminals that cannot see each other: each has its own login, its own sessions and its own view of the repo. Running Claude Code, Codex CLI and Gemini CLI side by side covers the manual setup, including worktrees so they do not overwrite each other's files.

Our recommendation from here is Hypervibe; we make it, so weigh it as the maker's view. It is a native Mac app that runs the codex you just installed, from your PATH and under your ChatGPT sign-in, as a real terminal on a visual board. Nothing about the Homebrew install changes.

  • One board for every CLI. Codex, Claude Code and Gemini CLI each get a console, and you see which one is working, resting or needing you.
  • Handoffs with state. "Pass this to codex" summarizes the session you are leaving and lands the brief on the Codex console as a prepared prompt. You press Enter.
  • Sessions come back. Reopen the app and each console relaunches in place and offers its CLI's own resume.
  • Two ChatGPT accounts stay separate. A work and a personal login run as two profiles of the same CLI, each with its own home folder.

Where it does not fit: Hypervibe needs macOS 14 or later on Apple Silicon, so an Intel Mac that runs Codex cannot run it, and it is a paid app at USD 19 a month or 190 a year. With one agent in one terminal, you do not need it.

Questions people ask

Is it brew install codex or brew install --cask codex?

Codex is published as a cask, and brew install --cask codex is the form the Codex README gives. At the time of writing there is no Homebrew formula with that name.

Does Codex CLI work on an Intel Mac?

Yes. Homebrew picks the Intel build on its own, and Codex lists macOS 12 or later as the requirement.

Do I need Node.js or npm?

Not with Homebrew: the cask installs a standalone binary. Node.js only matters if you choose the npm install instead.

Is Codex CLI free?

The CLI is open source under the Apache-2.0 license and costs nothing to install. Using it needs a ChatGPT plan that includes Codex (Plus, Pro, Business, Edu or Enterprise) or an OpenAI API key.

What is the difference between Codex CLI, the Codex app and Codex Web?

Codex CLI is the coding agent that runs locally in your terminal, which is what this guide installs. OpenAI also offers Codex as an IDE extension, as a desktop app you can open with codex app, and as Codex Web, the cloud-based agent at chatgpt.com/codex.

Can I use two ChatGPT accounts with Codex on one Mac?

Each login needs its own home folder, since Codex keeps its state in ~/.codex. Two accounts of the same CLI shows how to do it by hand and with Hypervibe profiles. Whether you may hold more than one account is for OpenAI to say in its terms.

Give Codex a console on the board

Hypervibe runs the codex you just installed as a real terminal next to Claude Code and Gemini CLI, with status per console, handoffs between agents and resume on reopen.

MACOS 14 OR LATER · APPLE SILICON · USD 19 / MONTH OR 190 / YEAR