Get Notified When Claude Code or Codex Needs You on Mac
Get a Mac notification when Claude Code or Codex finishes or needs input: hooks, Codex notify and terminal bells, plus Sledbot's built-in banners.
GuideUpdated 6 min read
On this page
You started an agent, switched to another window, and now you keep checking back to see whether it is done or stuck on a permission prompt. You want a Mac notification that says "Claude Code needs you" or "Codex finished", and ideally says which project.
Why you have to poll in the first place
Claude Code and Codex are terminal programs. They print to a screen and do not post macOS notifications on their own. People on the vendors' issue trackers and in terminal-app feature requests describe the same problem: with several agents running for minutes or hours, you check each tab by hand.
Both tools can run a command at certain moments, so you can wire up a notification yourself. The catch is knowing which agent fired it. Here is how the options compare.
| Method | Works for | Says which project? | Setup |
|---|---|---|---|
Claude Code hooks + osascript | Claude Code | Yes, if the message includes the folder name | Edit settings.json, add a script |
Codex notify + osascript | Codex | Not by default | Edit config.toml, add a script |
| Terminal OSC 9 / 777 notification | Anything that prints it | Only if your terminal names the tab | One printf, depends on the terminal |
| Sledbot | Agents running in Sledbot, including Claude Code and Codex | Yes, banners name the agent | None |
The first three are free and fine for one agent at a time. A bare terminal bell tells you something rang, not which tab. For Codex, a terminal bell has the same limit.
Fix 1: a notification script both agents can call
Both agents can run a command, so start with one small script that posts a standard macOS notification.
Create the folder and file:
bash mkdir -p ~/.local/bin nano ~/.local/bin/notify-agentPaste this, then save:
bash #!/bin/zsh # usage: notify-agent "Title" "Message" osascript -e "display notification \"$2 in $(basename "$PWD")\" with title \"$1\""osascriptis built into macOS.$(basename "$PWD")adds the name of the folder the script runs in, which is usually the project.Make it executable:
bash chmod +x ~/.local/bin/notify-agentTest it from Terminal:
bash ~/.local/bin/notify-agent "Test" "Hello"
To undo this fix, delete the file.
Fix 2: Claude Code hooks
Claude Code can run a command when it needs your attention (the Notification hook) and when it finishes responding (the Stop hook). Add this to ~/.claude/settings.json. If the file already has content, add the hooks key to the existing JSON instead of replacing the file.
{
"hooks": {
"Notification": [
{
"hooks": [
{
"type": "command",
"command": "$HOME/.local/bin/notify-agent 'Claude Code' 'needs you'"
}
]
}
],
"Stop": [
{
"hooks": [
{
"type": "command",
"command": "$HOME/.local/bin/notify-agent 'Claude Code' 'finished'"
}
]
}
]
}
}- Save the file and check the JSON is valid (a missing comma silently breaks hooks).
- Restart any running Claude Code session so it reads the change.
- Give it a task that needs a permission prompt and confirm a banner appears.
To undo, remove the hooks entries.
Fix 3: Codex notify
Codex CLI can run a program when it has something to tell you. Put this line near the top of ~/.codex/config.toml, before any [section] header, because TOML keys after a header belong to that section:
notify = ["/Users/yourname/.local/bin/notify-codex"]Replace yourname with your account name. Then create the script it points to:
#!/bin/zsh
~/.local/bin/notify-agent "Codex" "has something for you"Save it as ~/.local/bin/notify-codex and run chmod +x on it. Codex passes the script details about the event; the Codex CLI documentation from OpenAI lists what they contain and which events trigger notify. Check that the folder name in the banner is the project you expect. To undo, delete the notify line.
Fix 4: terminal notifications (OSC 9 and 777)
Some terminal apps turn an escape sequence into a macOS notification. OSC 9 and OSC 777 are the two common ones:
printf '\033]9;Claude Code finished\007'You can call this from a hook instead of osascript. Whether anything appears depends on your terminal: some show a notification, some ignore the sequence, and some only ring the bell. Look for a notifications option in your terminal's settings before relying on it. Over SSH or inside tmux, the sequence may never reach your terminal.
If notifications don't show up
| Symptom | Likely cause | Fix |
|---|---|---|
| Banner says "Script Editor", or nothing appears | macOS attributes osascript notifications to Script Editor | In System Settings, search for "Notifications" and allow Script Editor to show alerts |
| Nothing appears at all | A Focus mode is on | Turn Focus off or allow the posting app |
| Hook never runs | JSON typo, or notify placed under a [section] | Run the script by hand first, then recheck the config |
| "Permission denied" | Script not executable | Run chmod +x on it |
| Too many banners | Stop fires after every response | Keep Notification, remove Stop |
Checklist before you try again
notify-agentruns by hand and shows a banner.- The path in the hook or
notifyline is absolute and correct. settings.jsonis valid JSON;notifysits above any[section]inconfig.toml.- You restarted the agent session after editing.
- Script Editor is allowed in System Settings > Notifications.
The built-in route: Sledbot
Sledbot runs your agents in real terminals and tracks their status itself, so notifications need no hooks or config files. We make Sledbot, so weigh this section accordingly. The methods above are free and fine for a single agent.
Sledbot shows every agent as working, blocked (needs you), done, idle, error or exited. It reads status from OSC 7501 sequences, from agent hooks, and from the screen. For Claude Code it sets up its own per-launch hooks and leaves your global Claude config alone. Codex gets a notify hook.
For agents you aren't looking at, you get banners:
- "
<name>needs you" - "
<name>is done" - "
<name>hit an error" - Approval and question banners ("
<who>wants to", "<who>asks")
Banner actions include Allow once, Deny, Later (1 h) and Reply… (a field for your answer, then Send), plus up to 3 option buttons for questions. Clicking a banner focuses that agent's terminal, which answers the "which tab?" problem.
Beyond banners:
- Needs-you count on the Dock icon and as a bell in the menu bar (both on by default; the menu bar one applies after relaunch). Press ⌘J to jump to the next agent that needs you. The sidebar's Needs you page lists everything waiting, oldest first.
- Sounds per event, such as agent finished, needs your approval, asked a question, and error or crash. Sounds are on by default at volume 0.7 and stay silent while you're looking at that agent.
- Quiet controls in Settings > Notifications: quiet hours (off by default; 22:00–08:00 once on) and quiet while the microphone or camera is in use (on by default). Focus modes are respected.
- Agents keep running when you quit the app. They live in a background engine, and reopening Sledbot reattaches to them.
Limits to know:
- Notifications cover agents running in Sledbot. A Claude Code session in another terminal app isn't part of it.
- Phone push can't be set up from the app today, so don't count on alerts when you leave your Mac.
- Starting agents needs a MacSuite license or the 7-day trial. Sledbot needs macOS 14 or later.
Sledbot is part of MacSuite; you can try it free for 7 days. See the Sledbot product page, or read Needs you and approvals for the detail.
If nothing works
Contact the tool's vendor: Anthropic support for Claude Code hooks, OpenAI for Codex notify, or MacSuite support for Sledbot. Include the agent version, your config snippet, what you expected and what happened. For example:
Hi, my Notification hook in ~/.claude/settings.json does not fire.
Claude Code version: (output of claude --version)
macOS version: (your version)
The script works when run by hand and shows a banner.
Hook config is attached. Session restarted after editing.
What should I check next?Common questions
Can I get notified only when Claude Code needs me, not when it finishes?
Yes. Install only the Notification hook and skip Stop.
Will a hook notification tell me which terminal tab finished?
Not by itself. Put the folder name in the message, as the script above does.
Do hooks work if I close the terminal window?
Hooks only run while the agent runs, so closing the window normally ends them. To keep an agent alive, see Keep Claude Code running after you close the terminal.
Can I get these alerts on my phone?
Not reliably with the methods here, and Sledbot's phone option can't be set up from its app today.