Installing Codex with Homebrew gives you a package-managed CLI setup on macOS or Linux and keeps future updates aligned with the normal brew workflow.
Current OpenAI and Homebrew documentation publish Codex as the codex cask, so the install command is brew install --cask codex. Homebrew also installs required dependencies such as ripgrep during the same install.
This page assumes Homebrew already works in the current shell. The install is complete when codex --version prints the CLI version and a first codex run can start the login flow.
$ brew --version Homebrew 5.1.6
If brew is not available yet, install Homebrew first and then return to this page. The current Codex cask lists macOS 10.15 or later, or Linux, as supported Homebrew targets.
$ brew update Already up-to-date.
This avoids stale cask metadata when a newer Codex release has already been published upstream.
$ brew install --cask codex ==> Installing dependencies: ripgrep ==> Installing Cask codex ##### snipped ##### 🍺 codex was successfully installed!
Use --cask because Codex is currently packaged in Homebrew as a cask, not a formula.
$ command -v codex /usr/local/bin/codex
The resolved path can differ by Homebrew prefix. Common locations include /usr/local/bin/codex and /opt/homebrew/bin/codex.
$ codex --version codex-cli 0.121.0
The reported version changes as new Codex releases ship, but the command itself stays the same.
$ codex
On first launch, Codex prompts for the default ChatGPT sign-in flow when no cached session exists. Use How to log in to Codex with an API key for usage-based API access or How to log in to Codex with device authentication when the browser callback cannot be completed normally.