- 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…

📚 Get Practical Development Guides
Join developers getting comprehensive guides, code examples, optimization tips, and time-saving prompts to accelerate their development workflow.
Related Posts:
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.
Step 1: Check if Codex Is 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.
Step 2: Verify the Codex CLI Binary
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.
Step 3: Inspect the Codex Installation Folder
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.
Step 4: Verify the Codex Symlink
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.
Step 5: Clean the Broken Codex Installation
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.
Step 6: Reinstall Codex CLI on macOS
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
Step 7: Verify Codex CLI Works
Run:
codex --help
You should see the Codex CLI help output with commands such as:
execreviewapplyloginsandboxresume
This confirms the CLI is correctly installed.
Step 8: Login to Codex
Authenticate with your OpenAI account.
codex login
Once authenticated, the CLI can run coding tasks directly from your terminal.
Step 9: Test Codex with GPT-5.4 Medium
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.
Step 10: Run Codex for Code Review
Inside a Git repository you can run:
codex review
This performs an automated code review on the project.
Step 11: Apply Generated Code Changes
If Codex proposes modifications, apply them using:
codex apply
This runs git apply on the generated patch.
Recommended Codex CLI Settings
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.
Common macOS Codex Installation Issues
Codex Command Not Found
Cause Broken Homebrew symlink or missing artifact.
Fix Remove the cask directory and reinstall.
Empty Caskroom Folder
Cause Cached archive prevented extraction.
Fix Remove the Caskroom directory and reinstall.
Homebrew Path Missing
Ensure /opt/homebrew/bin exists in your PATH.
Check with:
echo $PATH
Final Result
After reinstalling, the Codex CLI should work from the terminal and support:
- repository analysis
- automated code review
- patch generation
- sandboxed command execution
- testing GPT-5.4 medium from the command line
You now have a working Codex CLI setup on macOS.
Frequently Asked Questions
Comments
No comments yet
Be the first to share your thoughts on this post!

