# How to get notified when Claude Code needs you on a Mac

> Claude Code alerts you on its own in iTerm2, Ghostty and Kitty, and one setting makes it ring the bell in any terminal. For a macOS banner or a sound, add two hooks to ~/.claude/settings.json that run osascript or afplay: Notification, for when Claude is waiting on you, and Stop, for when it has finished.

Source: https://gettenfold.app/guides/claude-code-notifications · By Romain Delage, maker of Tenfold · Published 2026-11-20 · Updated 2026-11-20

You start a long task, switch to your browser, and come back ten minutes later to find Claude has been sitting on a permission prompt the whole time. A notification fixes that. Claude Code has a little built in, and hooks cover the rest. This guide covers both, then what changes once you run several sessions at once.

## What does Claude Code do on its own?

When Claude finishes a task or pauses on a permission prompt, and you appear to be away from the terminal, Claude Code fires a notification event. What you see depends on your terminal, per Anthropic's [terminal configuration docs](https://code.claude.com/docs/en/terminal-config#get-a-terminal-bell-or-notification):

| Terminal | What Claude Code does by default |
|---|---|
| iTerm2, Ghostty, Kitty | Sends a desktop notification. iTerm2 shows it only after you turn on its alerts. |
| Apple Terminal | No sound. A silent bell character if the profile's Audible bell is off, which can flash the window or bounce the Dock icon. |
| Other terminals | Nothing. |

The `preferredNotifChannel` setting changes this. It appears in `/config` as **Local notifications**, and takes `auto` (the default), `terminal_bell`, `iterm2`, `iterm2_with_bell`, `kitty`, `ghostty` or `notifications_disabled`. To ring the bell in any terminal, add this to `~/.claude/settings.json`:

```json
{
  "preferredNotifChannel": "terminal_bell"
}
```

In Apple Terminal, also turn on **Audible bell** under **Settings > Profiles > Advanced**, or you won't hear it.

In iTerm2, turn the alerts on once: go to **Settings > Profiles > Terminal**, check **Notification Center Alerts**, click **Filter Alerts** and enable **Send escape sequence-generated alerts**. If you run Claude Code inside tmux, add `set -g allow-passthrough on` to `~/.tmux.conf` and restart Claude Code, or the notification never reaches your terminal.

## How do I get a macOS notification with a hook?

[Hooks](https://code.claude.com/docs/en/hooks-guide) are shell commands Claude Code runs at fixed points in a session. They work in every terminal, and they run alongside the built-in notification rather than replacing it. Two events matter here:

- **`Notification`** runs when Claude Code sends a notification. Its matcher filters by notification type.
- **`Stop`** runs when Claude has finished responding. It has no matcher and fires every time. It doesn't run when you interrupt Claude, and a turn that ends on an API error fires `StopFailure` instead.

This is Anthropic's own macOS example. Open `~/.claude/settings.json`, create it if it doesn't exist, and add:

```json
{
  "hooks": {
    "Notification": [
      {
        "matcher": "",
        "hooks": [
          {
            "type": "command",
            "command": "osascript -e 'display notification \"Claude Code needs your attention\" with title \"Claude Code\"'"
          }
        ]
      }
    ]
  }
}
```

If the file already has a `hooks` key, add `Notification` next to the events already in it instead of replacing the whole object. Type `/hooks` in Claude Code to confirm the hook is listed under `Notification`. To test it, ask Claude for something that needs permission, then switch to another app. The banner should appear after about six seconds.

**If no banner appears**, Script Editor probably lacks permission. `osascript` routes notifications through Script Editor, and without permission it fails silently. Run this once in Terminal:

```sh
osascript -e 'display notification "test"'
```

Then open **System Settings > Notifications**, find **Script Editor**, turn on **Allow Notifications**, and run the command again.

**For a sound instead of a banner**, use `afplay`:

```json
{
  "hooks": {
    "Notification": [
      {
        "hooks": [{ "type": "command", "command": "afplay /System/Library/Sounds/Glass.aiff" }]
      }
    ]
  }
}
```

Any file in `/System/Library/Sounds` works, like `Ping.aiff` or `Submarine.aiff`.

### Which notification types can you match?

An empty matcher fires on every type. These are the ones you'll use most, from the [hooks reference](https://code.claude.com/docs/en/hooks#notification):

| Matcher | Fires when |
|---|---|
| `permission_prompt` | A permission prompt has waited about six seconds |
| `idle_prompt` | Claude finished about 60 seconds ago and you haven't typed since |
| `elicitation_dialog` | An MCP server opened an input form and you haven't typed for about six seconds |
| `agent_needs_input` | A background session starts waiting on you while agent view is open |
| `agent_completed` | A background session finishes or fails while agent view is open |
| `auth_success` | Sign-in completes |

To match several, separate them with `|`, as in `"permission_prompt|idle_prompt"`.

Two details catch people out. In a terminal session, `permission_prompt`, `idle_prompt` and the elicitation types share the timing of desktop notifications, so they only fire when you seem to be away: every keystroke pushes the six-second timer back. And if you want a signal the instant Claude asks for permission, use a `PermissionRequest` hook instead. One that prints nothing and exits 0 makes no decision, so the normal prompt still asks you.

## How do I get notified when Claude Code is done?

Use the `Stop` hook. It fires at the end of every turn, including short replies and turns you watched happen. If that's too often, use the `idle_prompt` notification type instead: it waits about 60 seconds and fires only if you haven't typed since.

A notification script should always exit 0. On a `Stop` hook, exit code 2 blocks the stop and keeps Claude working, which is the opposite of what you want here.

## A script that names the project

A fixed message gets old quickly. Each hook receives JSON on stdin with `session_id`, `transcript_path`, `cwd` and `hook_event_name`. Notification hooks also get `message`, `notification_type` and an optional `title`, and Stop hooks get `last_assistant_message`. This script uses `cwd` to put the project folder in the banner.

Save it as `~/.claude/hooks/notify.sh`:

```bash
#!/bin/bash
# Shows a macOS notification naming the project and what Claude Code wants.
input=$(cat)
event=$(jq -r '.hook_event_name' <<<"$input")
project=$(basename "$(jq -r '.cwd' <<<"$input")")

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

osascript \
  -e 'on run argv' \
  -e 'display notification (item 2 of argv) with title "Claude Code" subtitle (item 1 of argv)' \
  -e 'end run' \
  "$project" "$message"
exit 0
```

Passing the text as arguments to `osascript` means quotes in a message can't break the AppleScript. The script uses `jq`; if `command -v jq` prints nothing, install it with `brew install jq`. Make the script executable with `chmod +x ~/.claude/hooks/notify.sh`, then point both events at it:

```json
{
  "hooks": {
    "Notification": [
      {
        "matcher": "permission_prompt|elicitation_dialog",
        "hooks": [{ "type": "command", "command": "~/.claude/hooks/notify.sh" }]
      }
    ],
    "Stop": [
      {
        "hooks": [{ "type": "command", "command": "~/.claude/hooks/notify.sh" }]
      }
    ]
  }
}
```

The matcher leaves out `idle_prompt` on purpose: with a `Stop` hook you already hear when Claude finishes, and `idle_prompt` would repeat it a minute later.

## Where does the hook config go?

Where you put a hook decides who gets it. From the [hooks guide](https://code.claude.com/docs/en/hooks-guide#configure-hook-location):

| File | Applies to | Shared |
|---|---|---|
| `~/.claude/settings.json` | Every project on your Mac | No |
| `.claude/settings.json` | One project | Yes, you can commit it |
| `.claude/settings.local.json` | One project | No, kept out of git when Claude Code creates it |

Notifications are a personal preference, so `~/.claude/settings.json` is usually right. Hooks from different files add up rather than replace each other, so a project's hooks don't remove yours. Claude Code normally picks up edits to these files while it runs. One more thing: it holds back hooks, including your own, until you accept the workspace trust dialog for a folder.

## Why notifications break down with many sessions

One session and one banner works well. Five sessions in five terminal tabs don't. The banner says something needs you, not which tab. Even with the project name in it, two sessions in the same repository look identical. And a banner can't take your answer: you still have to find the right tab, read the prompt and reply there. By the time you've done that, another one is waiting.

Claude Code has a few tools that help:

- **Name your sessions.** Start with `claude -n auth-refactor`, or run `/rename auth-refactor` mid-session. The terminal tab shows the name.
- **Use a terminal that shows session state.** If your terminal implements the OSC 7501 Program Status Protocol, it can show whether each session is working, waiting on you or done. This needs Claude Code v2.1.295 or later.
- **Run background sessions in agent view.** `claude agents` opens one screen for your [background sessions](https://code.claude.com/docs/en/agent-view), grouped under Needs input, Working and Completed. You can peek at a session and reply without attaching. It's in research preview.

## How Tenfold handles it

Tenfold, the Mac app I make for running many Claude Code agents side by side, takes a different approach. It doesn't send notification banners, play sounds or set a Dock badge. When an agent stops for a permission or a question, its buddy hangs under the Mac notch and knocks. Hover the notch and the prompt slides out, so you can answer it right there without switching windows. In the notch panel, ⌘J jumps to the next session that needs you. On a Mac without a notch, Tenfold draws one.

In the Workspace window, the Inbox layout (⌥⌘4) collects every permission prompt and question from every session, one at a time. A digit picks an answer, ↩ gives the default, Esc denies a permission and O opens the session.

It uses the same hooks this guide describes. Tenfold adds its own `Notification` and `PermissionRequest` hook groups to `~/.claude/settings.json`, they only report from agents started in Tenfold, and your own hooks stay as they are. So a banner or sound you set up keeps working if you want both. See [the Claude Code notch](https://gettenfold.app/claude-code-notch) for how it looks, and [What Tenfold changes](https://gettenfold.app/docs/what-tenfold-changes) for every hook it adds.

## Questions

### How do I get a notification when Claude Code needs input on a Mac?

Add a `Notification` hook to `~/.claude/settings.json` that runs `osascript -e 'display notification "Claude Code needs your attention" with title "Claude Code"'`. Claude Code runs it when a permission prompt has waited about six seconds, or about 60 seconds after Claude finished if you haven't typed since. In iTerm2, Ghostty and Kitty, Claude Code already sends a desktop notification without any hook (iTerm2 needs its alerts turned on first).

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

Add a `Stop` hook that runs `afplay /System/Library/Sounds/Glass.aiff`. `Stop` fires every time Claude finishes responding, except when you interrupt it. Any sound in `/System/Library/Sounds` works.

### Why doesn't my Claude Code osascript notification show up?

Most often, Script Editor doesn't have notification permission. `osascript` sends notifications through Script Editor, and without permission it fails silently. Run `osascript -e 'display notification "test"'` once in Terminal, then open System Settings, go to Notifications, find Script Editor and turn on Allow Notifications.

### What's the difference between the Notification and Stop hooks in Claude Code?

`Notification` fires when Claude Code wants your attention: a waiting permission prompt, an idle prompt, an MCP server asking for input and a few other types you can filter with the matcher. `Stop` fires each time Claude finishes a response, whether or not you're watching, and has no matcher.

### How do I know which Claude Code session needs input?

Name each session with `claude -n <name>` or `/rename` so its terminal tab shows the name, and put the project folder in your hook's notification text, read from the `cwd` field. For background sessions, `claude agents` groups them under Needs input. In [Tenfold](https://gettenfold.app/claude-code-notch), the waiting agent's buddy knocks under the notch and ⌘J jumps to it.

### Does Tenfold send macOS notifications?

No. Tenfold doesn't send notification banners, play sounds or set a Dock badge. When an agent needs you, its buddy hangs under the Mac notch and knocks, and you hover the notch to answer the prompt in place. Your own Claude Code hooks keep running, so you can keep a banner or sound too.

## Read next

- https://gettenfold.app/claude-code-notch
- https://gettenfold.app/claude-code-permission-prompts
- https://gettenfold.app/run-multiple-claude-code-agents
- https://gettenfold.app/guides/agentic-development-environment

---

Tenfold is a native Mac app for Claude Code, with live code review, git and the notch built in. https://gettenfold.app/
