- Fix & Install Codex CLI on macOS with Homebrew — v0.111.0
Fix & Install Codex CLI on macOS with Homebrew — v0.111.0
Step-by-step Homebrew troubleshooting to resolve 'zsh: command not found', reinstall Codex v0.111.0 and test GPT-5.4…

Join developers getting comprehensive guides, code examples, optimization tips, and time-saving prompts to accelerate their development workflow.
If you installed the Codex CLI on a Mac using Homebrew and see zsh: command not found: codex, the installation likely created a broken symlink or an empty cask directory. This guide shows how to fix it and update to the latest Codex CLI version (v0.111.0) to test GPT-5.4 medium.
This walkthrough applies to MacBook systems using Apple Silicon or Intel with Homebrew installed.
First confirm whether Homebrew installed the Codex cask.
brew list --cask | grep codex
If installed, you should see:
codex
Then check details:
brew info --cask codex
Typical output:
codex ✔: 0.111.0
OpenAI's coding agent that runs in your terminal
Artifacts
codex-aarch64-apple-darwin -> codex (Binary)
This means Homebrew should create a binary named codex.
Check if the executable exists.
which codex
Expected result:
/opt/homebrew/bin/codex
If you see:
zsh: command not found: codex
the binary is missing or the symlink is broken.
Homebrew installs casks here:
/opt/homebrew/Caskroom
Check the Codex directory:
ls /opt/homebrew/Caskroom/codex/0.111.0
If the directory is empty, the archive download or extraction failed.
This is a known Homebrew issue where the binary symlink exists but the artifact was never extracted.
Check the Homebrew binary symlink.
ls -l /opt/homebrew/bin/codex
Example output:
/opt/homebrew/bin/codex -> /opt/homebrew/Caskroom/codex/0.111.0/codex-aarch64-apple-darwin
If the target file does not exist, the installation is incomplete.
Remove the existing cask and broken files.
brew uninstall --cask codex
rm -rf /opt/homebrew/Caskroom/codex
rm -f /opt/homebrew/bin/codex
This clears the corrupted installation.
Install the latest version again using Homebrew.
brew install --cask codex
You should see:
Linking Binary 'codex-aarch64-apple-darwin' to '/opt/homebrew/bin/codex'
codex was successfully installed
Run:
codex --help
You should see the Codex CLI help output with commands such as:
execreviewapplyloginsandboxresumeThis confirms the CLI is correctly installed.
Authenticate with your OpenAI account.
codex login
Once authenticated, the CLI can run coding tasks directly from your terminal.
You can run a prompt using the model flag.
Example:
codex -m gpt-5.4-medium "explain this repository"
Or start an interactive session:
codex
Codex will analyze the current repository and help generate code, run commands, or review changes.
Inside a Git repository you can run:
codex review
This performs an automated code review on the project.
If Codex proposes modifications, apply them using:
codex apply
This runs git apply on the generated patch.
To allow Codex to modify files inside your workspace safely:
codex --sandbox workspace-write
For automatic command execution inside the project sandbox:
codex --full-auto
Avoid using full system access unless necessary.
Cause Broken Homebrew symlink or missing artifact.
Fix Remove the cask directory and reinstall.
Cause Cached archive prevented extraction.
Fix Remove the Caskroom directory and reinstall.
Ensure /opt/homebrew/bin exists in your PATH.
Check with:
echo $PATH
After reinstalling, the Codex CLI should work from the terminal and support:
You now have a working Codex CLI setup on macOS.