NotchOne

How to get a notification when Claude Code finishes

A free hook script for a Mac notification and sound when Claude Code is done or waiting on you, tested on 2.1.335

By NotchOne · Updated · 6 min read

To get a Claude Code notification on your Mac when it’s done: in iTerm2, Ghostty and Kitty, Claude Code already sends a desktop notification when it needs you. In Terminal, VS Code and Warp it doesn’t, so add a Stop hook (it fires when Claude finishes a reply) and a Notification hook (it fires when Claude waits for your approval) to ~/.claude/settings.json.

The script below does both, with a sound, in about two minutes and with no installs. Tested on Claude Code 2.1.335 and macOS 27.2 on 3 December 2026, with screenshots of its real notifications.

Checked

A terminal running Claude Code that says DONE, with a macOS notification: Claude Code, my-app, Finished. Your turn.
From Anthropic’s terminal configuration docs, checked 3 December 2026. Hooks run alongside the built-in notification; they don’t replace it.
TerminalBuilt-in notification?What to do
iTerm2Yes, once you turn on its alertsSettings › Profiles › Terminal › “Send escape sequence-generated alerts”
Ghostty, KittyYesNothing. Add the hook below if you also want a sound when Claude finishes
Terminal (Apple)No, only a silent bellUse the hook below
VS Code, Cursor, WarpNoUse the hook below
Inside tmuxNot by defaultAdd set -g allow-passthrough on to ~/.tmux.conf, or use the hook

Set up a Claude Code notification hook (free, 2 minutes)

Claude Code hooks are shell commands Claude Code runs at set moments. Two of them matter here:

  • Stop runs every time Claude finishes responding. That’s your “done” signal.
  • Notification runs when Claude Code sends a notification: a permission prompt, a question, or an idle reminder. That’s your “needs you” signal.

1. Save the script

Paste this into Terminal. It writes ~/.claude/notify.sh and makes it runnable:

cat > ~/.claude/notify.sh <<'EOF'
#!/bin/bash
# Claude Code hook: show a macOS notification. Reads the hook's JSON on stdin.
input=$(cat)
event=$(jq -r '.hook_event_name' <<<"$input")
project=$(basename "$(jq -r '.cwd' <<<"$input")")

if [ "$event" = "Stop" ]; then
  message="Finished. Your turn."
  sound="Glass"
else
  message=$(jq -r '.message // "Needs your attention"' <<<"$input")
  sound="Ping"
fi

osascript - "$message" "$project" "$sound" <<'APPLESCRIPT'
on run argv
  display notification (item 1 of argv) with title "Claude Code" subtitle (item 2 of argv) sound name (item 3 of argv)
end run
APPLESCRIPT
EOF
chmod +x ~/.claude/notify.sh

The script reads the JSON Claude Code passes to every hook. It puts the project folder in the subtitle, so with several sessions open you know which one is done. “Finished” plays the Glass sound; “needs you” plays Ping and shows Claude’s own message, such as “Claude needs your permission to use Bash”. It uses jq, which ships with macOS 15 and later. On macOS 14, install jq first.

2. Add the hooks to your settings

Open ~/.claude/settings.json (create it if it doesn’t exist) and add:

{
  "hooks": {
    "Stop": [
      {
        "hooks": [
          { "type": "command", "command": "~/.claude/notify.sh" }
        ]
      }
    ],
    "Notification": [
      {
        "matcher": "",
        "hooks": [
          { "type": "command", "command": "~/.claude/notify.sh" }
        ]
      }
    ]
  }
}

If the file already has a "hooks" key, add "Stop" and "Notification" next to the events already in it rather than replacing the whole object. To use it in one project only, put the same block in that project’s .claude/settings.json.

3. Let macOS show the notifications

osascript notifications come from Script Editor. If Script Editor isn’t allowed to notify, nothing shows up and there’s no error. Run this once:

osascript -e 'display notification "test" with title "Claude Code"'

Then open System Settings › Notifications › Script Editor and turn on Allow Notifications. Pick “Alerts” instead of “Banners” if you want the notification to stay until you dismiss it.

4. Test it

Claude Code picks up settings changes on its own; restart the session if nothing happens after a few seconds. Type /hooks to check that Stop and Notification are listed. Then ask Claude anything (“say hi” works) and switch to another app. You should get “Finished. Your turn.” with the project name. When Claude asks to run a command, you get its own message instead:

Two macOS notifications from the Claude Code hook script: my-app, Finished. Your turn; api-server, Claude needs your permission to use Bash
The script’s two real notifications on macOS 27.2, from a Stop hook and a Notification hook. Captured 3 December 2026.

Play a sound when Claude Code finishes

Only want a sound, no banner? Skip the script and use macOS’s built-in player as the hook command:

{ "type": "command", "command": "afplay /System/Library/Sounds/Glass.aiff" }

Any file in /System/Library/Sounds works: Hero, Ping, Purr, Submarine and so on. Use a different sound for Stop and for Notification so you can tell them apart by ear.

Which Claude Code hook events to use for notifications

The Notification hook takes a matcher. Leave it empty for every notification, or name the one you want:

Event names and timings from Anthropic’s hooks reference, checked 3 December 2026.
HookFires whenGood for
StopClaude finishes a reply. Not when you press Esc to interrupt it“It’s done, come back”
Notification, matcher permission_promptClaude needs approval for a tool and the prompt has waited about 6 secondsNever leaving Claude stuck on “Allow?”
Notification, matcher idle_promptClaude finished about 60 seconds ago and you haven’t typed sinceA reminder instead of an instant ping
StopFailureThe turn ended because of an API errorKnowing a long run died, not finished

If a notification after every single reply is too much, drop the Stop hook and keep idle_prompt. You’ll only hear about it when Claude has finished and you’ve been away for a minute.

Claude Code notifications in each terminal

Terminal (Apple)

Claude Code only sends a bell character here, and silently if “Audible bell” is off. Use the hook. If you’d rather hear the bell, set "preferredNotifChannel": "terminal_bell" in ~/.claude/settings.json and turn on Settings › Profiles › Advanced › Audible bell.

iTerm2

Turn on Settings › Profiles › Terminal › “Send escape sequence-generated alerts” and Claude Code’s own notifications appear. Add the Stop hook if you also want one when Claude finishes.

Ghostty and Kitty

Desktop notifications work out of the box. The hook is optional.

VS Code and Cursor

The integrated terminal gets no built-in notification, so use the hook. The hook settings work the same, because they live in ~/.claude/settings.json, not in the editor.

Warp

Use the hook, or set preferredNotifChannel to "terminal_bell" and let Warp handle the bell.

Claude Code notifications not working? Common problems

“Nothing shows up”

Almost always Script Editor’s notification permission (step 3). Also check that a Focus mode isn’t on, and run the script by hand: echo '{"hook_event_name":"Stop","cwd":"/tmp/test"}' | ~/.claude/notify.sh.

“Clicking the notification opens Script Editor”

That’s a limit of osascript: it can’t send you back to your terminal. For click-to-focus you need a helper app such as terminal-notifier, or an app that knows where each session lives.

“It pings after every reply”

That’s what Stop does. Use the idle_prompt matcher instead (see the table above).

“The approval notification is late”

By design: Claude Code waits about six seconds before sending a permission notification, so it doesn’t ping you when you’re already looking.

“I have four sessions and don’t know which one finished”

The script puts the project folder in the subtitle. Sessions in the same folder look the same, though, and you still have to find the right window yourself.

Questions

Does Claude Code have a built-in notification when it’s done?

In iTerm2, Ghostty and Kitty it sends a desktop notification when it needs your attention. In Apple’s Terminal, VS Code and Warp it doesn’t, so you add a Stop hook.

What’s the difference between the Stop and Notification hooks?

Stop fires every time Claude finishes responding. Notification fires when Claude Code wants your attention, for example a permission prompt or an idle reminder after about 60 seconds.

How do I make Claude Code play a sound when it’s done?

Add a Stop hook whose command is afplay /System/Library/Sounds/Glass.aiff. It plays every time Claude finishes a reply. The script on this page plays a sound and shows a notification.

Do hooks slow Claude Code down?

A notification script takes a fraction of a second. Claude Code runs it when the turn ends, so you won’t notice it.

Does this work for Codex?

No. These are Claude Code hooks in ~/.claude/settings.json. Codex has its own configuration.

Why does the notification come from Script Editor?

macOS sends osascript notifications through Script Editor. That’s why you allow notifications for Script Editor, and why clicking one opens it.

More guides →