How to get notified when Claude Code finishes on a Mac
By Anjali Singh, maker of Doki · Updated 22 November 2026
Claude Code can tell you when it's done, but it doesn't out of the box in every terminal. There are four ways to set it up on a Mac. Three are free and built in; the fourth is Doki, which we make.
The short answer
Add a Stop hook to ~/.claude/settings.json. Claude Code runs it every time it finishes responding, and the hook can show a macOS banner with osascript. Add a Notification hook as well, because Stop doesn't run when Claude is waiting for your permission. If you'd rather not edit settings, or you run several sessions at once and want to know which one finished and what it did, use an app such as Doki.
The four ways, side by side
| Way | Setup | When Claude is done | When Claude needs you | Says which session and what changed |
|---|---|---|---|---|
| 1. Your terminal's own alert | None, or one setting | Yes | Yes | No |
2. A Stop hook | Edit a settings file | Yes | No | Only if you script it |
3. A Notification hook | Edit a settings file | About a minute later | Yes, after about six seconds | Only if you script it |
| 4. Doki | One click | Yes | Yes | Yes |
1. Your terminal's own alert
In Ghostty, Kitty and iTerm2, Claude Code sends a desktop notification by itself when it finishes or needs you, as long as the terminal is allowed to show notifications in System Settings. In other terminals, such as Terminal.app, you can ask for a bell instead. Add this to ~/.claude/settings.json:
{
"preferredNotifChannel": "terminal_bell"
}
This is the least work, and it's enough if you run one session at a time. The alert doesn't say what Claude did. The details are in Claude Code's terminal setup docs.
2. A Stop hook: a banner the moment Claude is done
A hook is a command Claude Code runs at a set moment. The Stop hook runs when Claude finishes responding. This one shows a macOS banner and plays a sound. Put it in ~/.claude/settings.json:
{
"hooks": {
"Stop": [
{
"hooks": [
{
"type": "command",
"command": "osascript -e 'display notification \"Claude Code is done\" with title \"Claude Code\" sound name \"Glass\"'"
}
]
}
]
}
}
Three things to know:
- If the file already has a
hookssection, addStopinside it next to the others. Don't replace the whole section. osascriptsends the banner through the Script Editor app. If Script Editor isn't allowed to show notifications (System Settings, Notifications), nothing appears and there is no error.Stopdoesn't run when you interrupt Claude yourself, and it doesn't run when Claude is waiting for your permission. For that you need the next hook.
To check it's in place, type /hooks in Claude Code. That screen lists your hooks; it can't add or change them.
3. A Notification hook: when Claude needs you
The Notification hook runs when Claude Code wants your attention. The two cases that matter here are permission_prompt (Claude needs you to approve something, and the prompt has waited about six seconds) and idle_prompt (Claude finished about a minute ago and you haven't typed since). This hook covers permission prompts only:
{
"hooks": {
"Notification": [
{
"matcher": "permission_prompt",
"hooks": [
{
"type": "command",
"command": "osascript -e 'display notification \"Claude Code needs your OK\" with title \"Claude Code\"'"
}
]
}
]
}
}
Use it together with the Stop hook: both go inside the same hooks section. Leave the matcher empty ("") to get every kind of notification. The full list of events is in Claude Code's hooks reference, and our guide Claude Code hooks explained covers the ones that matter, with more examples.
4. Doki: the alert comes to you, and says what happened
Doki is a desktop pet for Mac. It uses the same hooks as above, but sets them up for you and does more with them:
- One click. Choose Connect Claude Code… in Doki's menu bar menu. Doki adds one command to
~/.claude/settings.jsonfor four events (Stop,Notification,UserPromptSubmitandSessionEnd), and takes it out again when you disconnect. - It says what changed. The pet walks over with the project's name and one line from Claude's last message, such as "shop finished: coupon codes work at checkout now".
- Many sessions at once. Each alert names its session and has a button that takes you to it. Permission prompts and questions go to the front of the queue.
- Away from your Mac. Doki saves everything up and tells you when you're back.
- Private. The hook only talks to Doki on your own Mac (
127.0.0.1) with a secret token, and gives up after two seconds, so it can't slow Claude down. The privacy page shows the exact command.
Doki's agent alerts, Claude Code included, are free for your first week. $7.69 once keeps them on and unlocks every pet. It works with Codex, Cursor and Gemini CLI too. It needs macOS 13 or later. Download Doki, or see the FAQ.
Which one should you use?
- One session, in Ghostty, Kitty or iTerm2: nothing to do. The terminal's own alert is enough.
- One session, in another terminal: the bell setting, or the
StopandNotificationhooks together if you want a banner. - Several sessions, or you want to know what Claude did without switching windows: Doki, or a script of your own that reads the session's name and last message from what the hook receives.
Want alerts on your phone, or a menu bar app instead? See Claude Code notification tools compared.
Questions
Why doesn't my Stop hook fire when Claude asks for permission?
Because Claude hasn't finished; it's waiting. Permission prompts arrive through the Notification hook, as permission_prompt, after the prompt has waited about six seconds.
Why does my osascript notification not show up?
Most often Script Editor isn't allowed to show notifications, or a Focus mode is on. Open System Settings, then Notifications, and allow Script Editor. Running the osascript command by hand in Terminal is a quick test.
Do hooks slow Claude Code down?
A hook that shows a banner returns straight away. A hook that waits on something slow can hold Claude up, which is why Doki's hook gives up after two seconds.
Does this work with Claude Code in VS Code and the Claude app?
Hooks live in ~/.claude/settings.json, so they run wherever Claude Code runs on your Mac. Doki works with sessions in Terminal, VS Code, Cursor and other editors. Sessions that run in the cloud, or in the Claude app's sandbox, run somewhere else and can't reach Doki yet.