Codex CLI brings a coding agent into the terminal, where the shell needs a working codex executable before a project session can begin. Homebrew supplies a managed installation for macOS and Linux.

OpenAI lists Homebrew as a supported installation method. The community-maintained Codex cask downloads OpenAI's platform-specific release and links it into the Homebrew prefix, keeping later upgrades under the same package manager.

A working Homebrew installation and a shell that loads its environment are required. Package installation does not require an OpenAI sign-in; authentication is separate from making the CLI available.

Steps to install Codex CLI with Homebrew:

  1. Check that Homebrew is available in the current shell.
    $ brew --version
    Homebrew 7.0.11

    Homebrew must already be installed and loaded in this shell.
    Related: Install Homebrew on macOS
    Related: Homebrew on Linux

  2. Update the local Homebrew metadata.
    $ brew update
    ==> Updating Homebrew...
    Already up-to-date.
  3. Install the Codex CLI cask as your normal Homebrew user.
    $ brew install --cask codex

    The --cask flag selects the Homebrew package for Codex CLI. The cask downloads the binary for the current operating system and CPU architecture.

  4. Confirm that the current shell resolves the Homebrew codex binary.
    $ command -v codex
    /home/linuxbrew/.linuxbrew/bin/codex

    The path depends on the Homebrew prefix. Common macOS paths are shown below. A path outside the Homebrew prefix can indicate that another installation takes precedence on PATH.

    /opt/homebrew/bin/codex
    /usr/local/bin/codex
  5. Verify that the installed Codex CLI binary runs.
    $ codex --version
    codex-cli 0.166.0

    A codex-cli version line confirms that the executable resolved by the shell can run. The release number changes as new versions ship.
    Related: How to check Codex CLI version

Share this guide