---
title: "Fix & Install Codex CLI on macOS with Homebrew — v0.111.0"
slug: "fix-install-codex-cli-macos-homebrew-v0-111-0"
published: "2026-03-06"
updated: "2026-04-06"
validated: "2026-03-06"
categories:
  - "Tools"
tags:
  - "Codex CLI macOS"
  - "install codex cli"
  - "Homebrew codex fix"
  - "zsh: command not found codex"
  - "codex v0.111.0"
  - "GPT-5.4 medium"
  - "Caskroom codex"
  - "brew uninstall --cask codex"
  - "codex review apply"
  - "sandbox workspace-write"
  - "macOS terminal troubleshooting"
  - "Homebrew cask extraction issue"
llm-intent: "reference"
audience-level: "beginner"
framework-versions:
  - "homebrew"
  - "macos"
  - "zsh"
  - "codex cli"
  - "gpt-5.4-medium"
status: "stable"
llm-purpose: "Codex CLI macOS: fix 'zsh: command not found' by cleaning broken Homebrew casks, reinstalling v0.111.0, and verifying GPT-5.4 medium — follow the…"
llm-prereqs:
  - "Access to Homebrew"
  - "Access to macOS"
  - "Access to zsh"
  - "Access to Codex CLI"
  - "Access to gpt-5.4-medium"
llm-outputs:
  - "Completed outcome: Codex CLI macOS: fix 'zsh: command not found' by cleaning broken Homebrew casks, reinstalling v0.111.0, and verifying GPT-5.4 medium — follow the…"
---

**Summary Triples**
- (Fix & Install Codex CLI on macOS with Homebrew — v0.111.0, focuses-on, Codex CLI macOS: fix 'zsh: command not found' by cleaning broken Homebrew casks, reinstalling v0.111.0, and verifying GPT-5.4 medium — follow the…)
- (Fix & Install Codex CLI on macOS with Homebrew — v0.111.0, category, general)

### {GOAL}
Codex CLI macOS: fix 'zsh: command not found' by cleaning broken Homebrew casks, reinstalling v0.111.0, and verifying GPT-5.4 medium — follow the…

### {PREREQS}
- Access to Homebrew
- Access to macOS
- Access to zsh
- Access to Codex CLI
- Access to gpt-5.4-medium

### {STEPS}
1. Confirm Codex cask is installed
2. Verify the Codex binary path
3. Inspect the Caskroom install folder
4. Check the Homebrew symlink target
5. Remove broken cask and symlink
6. Reinstall Codex via Homebrew
7. Verify Codex help output
8. Authenticate with your account
9. Test the GPT-5.4 medium model
10. Run an automated code review
11. Apply generated code changes safely

<!-- llm:goal="Codex CLI macOS: fix 'zsh: command not found' by cleaning broken Homebrew casks, reinstalling v0.111.0, and verifying GPT-5.4 medium — follow the…" -->
<!-- llm:prereq="Access to Homebrew" -->
<!-- llm:prereq="Access to macOS" -->
<!-- llm:prereq="Access to zsh" -->
<!-- llm:prereq="Access to Codex CLI" -->
<!-- llm:prereq="Access to gpt-5.4-medium" -->
<!-- llm:output="Completed outcome: Codex CLI macOS: fix 'zsh: command not found' by cleaning broken Homebrew casks, reinstalling v0.111.0, and verifying GPT-5.4 medium — follow the…" -->

# Fix & Install Codex CLI on macOS with Homebrew — v0.111.0
> Codex CLI macOS: fix 'zsh: command not found' by cleaning broken Homebrew casks, reinstalling v0.111.0, and verifying GPT-5.4 medium — follow the…
Matija Žiberna · 2026-03-06

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.

## LLM Response Snippet
```json
{
  "goal": "Codex CLI macOS: fix 'zsh: command not found' by cleaning broken Homebrew casks, reinstalling v0.111.0, and verifying GPT-5.4 medium — follow the…",
  "responses": [
    {
      "question": "What does the article \"Fix & Install Codex CLI on macOS with Homebrew — v0.111.0\" cover?",
      "answer": "Codex CLI macOS: fix 'zsh: command not found' by cleaning broken Homebrew casks, reinstalling v0.111.0, and verifying GPT-5.4 medium — follow the…"
    }
  ]
}
```