Installing Codex CLI through Homebrew fits macOS or Linux developer hosts that already use brew for command-line tools. The package manager owns the download, dependency install, and later upgrade path, so the active terminal keeps using one managed codex binary.
OpenAI documents Codex CLI as the terminal interface for local coding work. Homebrew currently publishes it as the codex cask, which links the platform binary into the Homebrew prefix and installs required runtime tools such as ripgrep; on Linux, the cask can also pull sandbox and runtime packages such as bubblewrap.
Start from a shell where brew already works and the Homebrew prefix is on PATH. The install is complete when command -v codex resolves to the Homebrew binary, codex --version prints a codex-cli release, and a new install is ready for the first ChatGPT or API-key sign-in.
Related: How to upgrade Codex CLI with Homebrew
Related: How to check Codex CLI version
$ brew --version Homebrew 6.0.1
If brew is missing, install Homebrew first and open a new shell that loads the Homebrew environment.
Related: Install Homebrew on macOS
$ brew update ==> Updating Homebrew... Already up-to-date.
$ brew install --cask codex ==> Fetching downloads for: codex ==> Installing dependencies: libcap, bubblewrap, zlib-ng-compat, bzip2, pcre2, ripgrep ##### snipped ##### ==> Installing Cask codex ==> Linking Binary 'codex-aarch64-unknown-linux-musl' to '/home/linuxbrew/.linuxbrew/bin/codex' 🍺 codex was successfully installed!
Use --cask because Homebrew publishes Codex CLI as the codex cask. Dependency names and binary suffixes differ between macOS and Linux.
$ command -v codex /home/linuxbrew/.linuxbrew/bin/codex
The path can differ by platform and Homebrew prefix. Common macOS prefixes include /opt/homebrew/bin/codex and /usr/local/bin/codex.
$ codex --version codex-cli 0.139.0
The version number changes as new releases ship.
Related: How to check Codex CLI version
$ codex login status Not logged in
Not logged in is expected on a fresh install. Use the first interactive codex run for ChatGPT sign-in, or use an explicit login method when the terminal cannot open the normal browser flow.
Related: How to log in to Codex with an API key
Related: How to log in to Codex with device authentication
$ codex