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.
Steps to install Codex CLI with Homebrew:
- Confirm that Homebrew is available in the current shell before installing Codex.
$ 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.
- Refresh the local Homebrew metadata so the current Codex cask definition is available.
$ brew update Already up-to-date.
This avoids stale cask metadata when a newer Codex release has already been published upstream.
- Install the current Codex cask.
$ 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.
- Confirm that the codex executable is now on the current PATH.
$ 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.
- Verify the installed Codex CLI version.
$ codex --version codex-cli 0.121.0
The reported version changes as new Codex releases ship, but the command itself stays the same.
- Start Codex and complete the first login flow from the same terminal environment.
$ 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.
Mohd Shakir Zakaria is a cloud architect with deep roots in software development and open-source advocacy. Certified in AWS, Red Hat, VMware, ITIL, and Linux, he specializes in designing and managing robust cloud and on-premises infrastructures.
