BuildWithMatija
  1. Home
  2. Blog
  3. Tools
  4. 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…

6th March 2026·Updated on:6th April 2026··
Tools
Fix & Install Codex CLI on macOS with Homebrew — v0.111.0

📚 Get Practical Development Guides

Join developers getting comprehensive guides, code examples, optimization tips, and time-saving prompts to accelerate their development workflow.

No spam. Unsubscribe anytime.

Related Posts:

  • •Fix Claude Code Auto Update Failed on Mac (ENOTEMPTY npm Error)
  • •OAuth for MCP Server: Complete Guide to Protecting Claude
📄View markdown version
0

Frequently Asked Questions

About the author

Matija Žiberna

Matija Žiberna

Full-stack developer, co-founder

AboutResume

Self-taught full-stack developer sharing lessons from building software and startups.

I'm Matija Žiberna, a self-taught full-stack developer and co-founder passionate about building products, writing clean code, and figuring out how to turn ideas into businesses. I write about web development with Next.js, lessons from entrepreneurship, and the journey of learning by doing. My goal is to provide value through code—whether it's through tools, content, or real-world software.

You might be interested in

Fix Claude Code Auto Update Failed on Mac (ENOTEMPTY npm Error)
Fix Claude Code Auto Update Failed on Mac (ENOTEMPTY npm Error)

30th September 2025

OAuth for MCP Server: Complete Guide to Protecting Claude
OAuth for MCP Server: Complete Guide to Protecting Claude

7th December 2025

Contents

  • Step 1: Check if Codex Is Installed
  • Step 2: Verify the Codex CLI Binary
  • Step 3: Inspect the Codex Installation Folder
  • Step 4: Verify the Codex Symlink
  • Step 5: Clean the Broken Codex Installation
  • Step 6: Reinstall Codex CLI on macOS
  • Step 7: Verify Codex CLI Works
  • Step 8: Login to Codex
  • Step 9: Test Codex with GPT-5.4 Medium
  • Step 10: Run Codex for Code Review
  • Step 11: Apply Generated Code Changes
  • Recommended Codex CLI Settings
  • Common macOS Codex Installation Issues
  • Codex Command Not Found
  • Empty Caskroom Folder
  • Homebrew Path Missing
  • Final Result
On this page:
  • Step 1: Check if Codex Is Installed
  • Step 2: Verify the Codex CLI Binary
  • Step 3: Inspect the Codex Installation Folder
  • Step 4: Verify the Codex Symlink
  • Step 5: Clean the Broken Codex Installation
Build with Matija logo

Build with Matija

Modern websites, content systems, and AI workflows built for long-term growth.

Services

  • Headless CMS Websites
  • Next.js & Headless CMS Advisory
  • AI Systems & Automation
  • Website & Content Audit

Resources

  • Case Studies
  • How I Work
  • Blog
  • CMS Hub
  • E-commerce Hub
  • Dashboard

Headless CMS

  • Payload CMS Developer
  • CMS Migration
  • Multi-Tenant CMS
  • Payload vs Sanity
  • Payload vs WordPress
  • Payload vs Contentful

Get in Touch

Ready to modernize your stack? Let's talk about what you're building.

Book a discovery callContact me →
© 2026Build with Matija•All rights reserved•Privacy Policy•Terms of Service
BuildWithMatija
Get In Touch

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.

bash
brew list --cask | grep codex

If installed, you should see:

bash
codex

Then check details:

bash
brew info --cask codex

Typical output:

bash
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.

bash
which codex

Expected result:

bash
/opt/homebrew/bin/codex

If you see:

bash
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:

bash
/opt/homebrew/Caskroom

Check the Codex directory:

bash
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.

bash
ls -l /opt/homebrew/bin/codex

Example output:

bash
/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.

bash
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.

bash
brew install --cask codex

You should see:

bash
Linking Binary 'codex-aarch64-apple-darwin' to '/opt/homebrew/bin/codex'
codex was successfully installed

Step 7: Verify Codex CLI Works

Run:

bash
codex --help

You should see the Codex CLI help output with commands such as:

  • exec
  • review
  • apply
  • login
  • sandbox
  • resume

This confirms the CLI is correctly installed.


Step 8: Login to Codex

Authenticate with your OpenAI account.

bash
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:

bash
codex -m gpt-5.4-medium "explain this repository"

Or start an interactive session:

bash
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:

bash
codex review

This performs an automated code review on the project.


Step 11: Apply Generated Code Changes

If Codex proposes modifications, apply them using:

bash
codex apply

This runs git apply on the generated patch.


Recommended Codex CLI Settings

To allow Codex to modify files inside your workspace safely:

bash
codex --sandbox workspace-write

For automatic command execution inside the project sandbox:

bash
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:

bash
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.