All guides

Codex CLI notifications on macOS

Updated 19 November 2026 · 5 min read

On macOS, the Codex CLI already sends a desktop notification by itself in Ghostty, iTerm2, Kitty, Warp and WezTerm when a turn finishes or an approval is waiting and the terminal isn't focused. Apple Terminal only gets the bell. For a real notification in any terminal, add a Stop hook (and a PermissionRequest hook for approvals) to ~/.codex/hooks.json that runs osascript -e 'display notification ...', then trust them with /hooks. Allow notifications for Script Editor in System Settings, or the osascript command fails without a word.

01What Codex does by default on a Mac

Codex's built-in alert is controlled by [tui] in ~/.codex/config.toml, and it's on by default. With notification_method = "auto", Codex picks:

TerminalWhat you get
Ghostty, iTerm2, Kitty, Warp, WezTermA desktop notification (the OSC 9 escape sequence)
Apple Terminal, VS Code's terminal, Alacritty and othersThe terminal bell character

By default it only fires when the terminal is not focused (notification_condition = "unfocused"). Some terminals need their own setting before the alert shows. In iTerm2, check the profile's Terminal settings for notification options, and make sure iTerm2 is allowed to send notifications in System Settings.

In Apple Terminal, the bell can at least bounce the Dock icon or show a badge: in Terminal > Settings > Profiles > Advanced, turn on the Bell options you want. The built-in notifications guide covers every setting.

02A hook for any terminal

Hooks run from Codex itself, so they work in every terminal. Add this to ~/.codex/hooks.json (create it if needed; merge into an existing hooks object):

{
  "hooks": {
    "Stop": [
      {
        "hooks": [
          {
            "type": "command",
            "command": "osascript -e 'display notification \"Codex has finished\" with title \"Codex\" sound name \"Glass\"' >/dev/null"
          }
        ]
      }
    ],
    "PermissionRequest": [
      {
        "hooks": [
          {
            "type": "command",
            "command": "osascript -e 'display notification \"Codex wants your approval\" with title \"Codex\"' >/dev/null"
          }
        ]
      }
    ]
  }
}

Start codex, type /hooks and trust both entries. Codex won't run a new or changed hook until you do.

The >/dev/null matters: Codex treats plain text printed by a Stop hook as invalid output. The PermissionRequest hook prints no decision, so the approval prompt appears in the terminal as usual; the hook only tells you it's there.

03Allow Script Editor to notify

osascript shows notifications as Script Editor. On a fresh Mac, the first one is often dropped silently. To fix it:

  1. Run osascript -e 'display notification "test" with title "Codex"' in Terminal.
  2. Open System Settings > Notifications, find Script Editor, and turn on Allow Notifications. Choose Alerts if you want the notification to stay until dismissed.
  3. Check Focus isn't hiding it (see quiet hours and Do Not Disturb).

04Clickable notifications with terminal-notifier

terminal-notifier (from Homebrew: brew install terminal-notifier) gives you more control: a group, so new alerts replace old ones, and a click action that brings your terminal forward.

"command": "terminal-notifier -title Codex -message 'Codex has finished' -group codex -activate com.googlecode.iterm2 >/dev/null"

Swap the bundle id for your terminal: com.apple.Terminal, com.mitchellh.ghostty, dev.warp.Warp-Stable or com.microsoft.VSCode. OpenAI's own notify example uses terminal-notifier in the same way; see the notify guide.

05Including the project name

When several sessions run at once, "Codex has finished" isn't enough. The hook gets the session's folder as cwd on stdin, so a small script can put the project in the title. The Stop hook guide has one, and several sessions covers the rest.

06A sound only

If you'd rather hear than see, play a system sound:

"command": "afplay /System/Library/Sounds/Glass.aiff"

07Or let codex-notifier do it

Notifier for Codex's free codex-notifier tool sets this up for you on a Mac (and on Windows and Linux). Install it with:

curl -fsSL https://notifierforcodex.com/install.sh | sh

or with Homebrew: brew trust --formula touch-tap/tap/codex-notifier && brew install touch-tap/tap/codex-notifier, then run codex-notifier once (the curl line does this for you). It adds its hooks to ~/.codex/hooks.json, marks them trusted, and shows a macOS notification with the project name when Codex finishes, wants approval or asks a question. No network is needed for that.

Pair the iPhone or Android app and the same moments reach your phone, where you can approve, reject, answer or send the next instruction. On a Mac it also knows whether the terminal Codex runs in is the frontmost app, so it stays quiet while you're watching. Notifier for Codex is independent and not affiliated with OpenAI. See pricing for the phone apps.

08FAQ

Why does Codex's built-in notification not show in Apple Terminal?

Codex only uses the OSC 9 desktop notification in terminals that support it (Ghostty, iTerm2, Kitty, Warp and WezTerm). In Apple Terminal it rings the bell instead. Use a hook for a real notification.

My osascript hook works in Terminal but not from Codex. Why?

Usually trust: Codex skips the hook until you trust it in /hooks. If /hooks shows it trusted, check hooks.json is valid JSON and that the command prints nothing.

Can I get notifications even while the terminal is focused?

For the built-in alert, set notification_condition = "always" under [tui]. Hooks don't check focus at all; they fire every time.

Do these notifications reach my iPhone?

No. A macOS notification stays on the Mac. For a push on your phone, use ntfy, a chat app or Notifier for Codex.

Notifier for Codex Get a push on your phone when Codex finishes or needs you, then approve, reject or answer from there. The codex-notifier command line tool is free on Mac, Windows and Linux.