CODEX

Codex notifications, how to know when Codex is done or waiting for you

How to get Codex CLI notifications on macOS when a turn finishes or an approval is waiting, using tui.notifications, the notify setting and hooks.

Short answer

Codex CLI has two notification mechanisms. The built-in tui.notifications setting sends terminal notifications for agent-turn-complete and approval-requested, and the notify setting runs your own program with a JSON payload when a turn completes. On macOS you can pair notify with terminal-notifier or osascript, or use a Stop or PermissionRequest hook.

Codex notifications tell you when the agent has finished a turn or is waiting for your approval, so you do not have to keep checking the terminal. Codex CLI offers two built-in mechanisms: TUI notifications sent through your terminal, and a notify program that Codex runs when a turn completes. Hooks give you a third option.

This guide covers each one with the exact config.toml keys, shows working macOS setups, and explains which mechanism catches which event. That last part matters, because the most common complaint is getting a ping when Codex finishes but missing the one when it is blocked on an approval.

How do I get notifications from Codex CLI?

The simplest setup is the built-in TUI notifications, configured in the [tui] table of ~/.codex/config.toml:

[tui]
notifications = ["agent-turn-complete", "approval-requested"]
notification_method = "auto"
notification_condition = "unfocused"

notifications accepts true, false, or a list of event types. The documented event types are agent-turn-complete (the agent finished and is waiting for input) and approval-requested (the agent needs your permission). Listing both covers the two moments you care about.

notification_condition controls when they fire: unfocused, the default, only notifies when the terminal does not have focus, and always notifies regardless. notification_method controls how: osc9, bel, or auto, the default.

What is the difference between OSC 9 and BEL?

OSC 9 and BEL are two ways a terminal program can signal you. OSC 9 is an escape sequence that asks the terminal to show a desktop notification with text. BEL is the classic terminal bell character. In auto mode, Codex prefers OSC 9 and falls back to BEL.

What you actually see depends on your terminal. A terminal that supports OSC 9 shows a real notification with the message; one that does not may only beep or badge its Dock icon on BEL. If TUI notifications seem to do nothing, check your terminal's documentation for OSC 9 support and its bell settings, and make sure macOS allows notifications for the terminal app in System Settings.

How does the Codex notify setting work?

The notify setting runs an external program when Codex emits a supported event. Today that event is only agent-turn-complete. Codex passes a single JSON argument to the program:

notify = ["python3", "/Users/me/.codex/notify.py"]

The payload includes type, thread-id, turn-id, cwd, input-messages and last-assistant-message. Set notify in your user-level ~/.codex/config.toml: the configuration reference says project-local .codex/config.toml ignores this key.

The Codex docs describe the split this way: notify is for external programs such as webhooks, desktop notifiers and CI hooks, while tui.notifications is built into the TUI and can filter by event type. In practice, many people use tui.notifications for approvals and notify for completions so they are not alerted twice.

How do I get a native macOS notification when Codex finishes?

Pair notify with terminal-notifier, a small open source command-line tool that posts macOS notifications. The Codex docs use it in their own examples. Install it with Homebrew:

brew install terminal-notifier

Then save this script as ~/.codex/notify.py:

import json
import os
import subprocess
import sys

payload = json.loads(sys.argv[1])

if payload.get("type") != "agent-turn-complete":
    sys.exit(0)

project = os.path.basename(payload.get("cwd", "")) or "Codex"
message = (payload.get("last-assistant-message") or "Turn complete")[:180]

subprocess.run([
    "terminal-notifier",
    "-title", f"Codex: {project}",
    "-message", message,
    "-group", "codex-" + payload.get("thread-id", ""),
])

Point notify at it as shown above. Each completed turn now shows a notification titled with the project folder and the start of Codex's last reply. The -group option makes a newer notification for the same thread replace the older one instead of stacking.

If you would rather not install anything, macOS ships osascript, which can post a basic notification:

osascript -e 'display notification "Codex finished its turn" with title "Codex"'

How do I get notified when Codex needs approval?

Use approval-requested in tui.notifications, since notify does not fire for approvals. With the [tui] example above, Codex notifies you when it is blocked on a permission and your terminal is in the background.

If you want a native notification with your own text, use a hook. Codex hooks include a PermissionRequest event that fires when Codex needs a permission decision. A hook that only posts a notification and returns no decision leaves the normal prompt in place:

{
  "hooks": {
    "PermissionRequest": [
      {
        "matcher": "*",
        "hooks": [
          {
            "type": "command",
            "command": "terminal-notifier -title Codex -message 'Approval needed' -group codex-approval",
            "async": true
          }
        ]
      }
    ]
  }
}

Save it in ~/.codex/hooks.json. Codex asks you to trust a new hook before it runs; use /hooks to review and trust it. The Codex hooks guide covers events, trust and output in detail.

Which Codex notification mechanism should I use?

Pick by event and by how much control you want:

NeedMechanismNotes
Turn finished, minimal setuptui.notificationsDepends on terminal OSC 9 support
Approval waiting, minimal setuptui.notifications with approval-requestedFires only when unfocused by default
Turn finished, custom text or webhooknotifyReceives a JSON payload; user config only
Approval waiting, custom actionPermissionRequest hookNeeds a one-time trust step
Turn finished, from a hookStop hookPlain text on stdout is invalid for Stop

The Codex desktop app has its own notification settings for turn completion, permissions and questions, and the IDE extension relies on notify on the connected host.

Why do notifications still leave me checking the terminal?

A notification tells you that Codex is waiting, but you still have to switch to the right terminal tab, find the prompt and answer it. With several sessions open, a banner that says "Approval needed" does not say which project or what command. That friction is why people drift toward looser approval settings, which is a worse trade. The article on coding while doing something else goes into this pattern, and the Claude Code notifications on Mac guide covers the same problem for Claude Code.

Answering Codex from the notification itself

Allowbar is a macOS menu bar app that turns the notification into the answer. It connects through Codex's hooks (its entry goes in ~/.codex/hooks.json, next to yours) and Codex asks you to trust it the first time, a step Allowbar never skips. When Codex needs approval, a Dynamic Island style panel slides down from the top of the screen with the project, the tool and the exact command, and you choose Allow, Block, or Terminal. If you do not answer before the countdown ring runs out, the question goes back to the terminal.

Allowbar also sends a done notification when a task finishes, lists every Codex and Claude Code session with its state (the ones waiting on you at the top), and opens the right terminal tab when you click one. It never approves anything on its own. It is Mac only, works on macOS 14 or later, and supports Claude Code and Codex. Allowbar is in private beta: join the waitlist, the launch price is $9.99 instead of $29.90. To see how it differs from plain alerts, read Allowbar vs terminal notifications.

Sources

Frequently asked questions

Does Codex CLI have built-in notifications?

Yes. The [tui] table in config.toml has a notifications key that accepts true, false or a list such as ["agent-turn-complete", "approval-requested"]. Codex sends them through your terminal using OSC 9 or the terminal bell.

Why does the Codex notify script not fire for approvals?

The notify setting currently only handles the agent-turn-complete event. For approvals, add approval-requested to tui.notifications, or use a PermissionRequest hook in ~/.codex/hooks.json.

Why am I not getting Codex notifications on my Mac?

By default tui.notification_condition is unfocused, so nothing fires while the terminal is in front. Also check that your terminal supports OSC 9, that macOS allows notifications for the terminal app, and that notify is set in ~/.codex/config.toml rather than a project config, which ignores it.

What does the Codex notify payload contain?

It is a single JSON argument with type (currently agent-turn-complete), thread-id, turn-id, cwd, input-messages and last-assistant-message. Your script can use cwd to name the project and last-assistant-message for the notification text.

ALLOWBAR FOR MAC

Answer your agents from the menu bar.

Permission requests from Claude Code and Codex slide down from the top of your screen. Allow, Block or send back to the terminal. Allowbar never approves anything on its own.

Launch price $9.99 instead of $29.90, one-time purchase, lifetime license.