---
title: "Claude Code notifications hook: Easy macOS desktop alerts guide"
description: "Stop watching your terminal. Learn how to set up Claude Code notifications hooks for instant macOS desktop alerts and improve your CLI workflow today."
---

# Claude Code notifications hook: Easy macOS desktop alerts guide

Published: 2026-09-08T02:35:42.915Z

Author: [Goon Nguyen](/author/goon)

Reading time: 11 minutes

Stop watching your terminal. Learn how to set up Claude Code notifications hooks for instant macOS desktop alerts and improve your CLI workflow today.

# Claude Code notifications hook: Simple macOS desktop alerts that actually help

Claude Code is often running while you are doing something else: Reading docs, reviewing tickets, or coding in another window. The friction is not the run itself. The friction is missing the moment when Claude Code needs your attention and having to keep checking the terminal. This guide covers the simplest setup to implement a Claude Code notifications hook for desktop alerts. You will get a minimal configuration, the right file locations, a working macOS example, and quick fixes for the setup issues that usually waste the most time.

![Image](https://cdn.agentkit.best/blog/cfai-media/5af86610af1bd5e60325ad77708e454f24a767f5c8cbbe7bd07bb11c584eb872-8d13bbd74f2385313ad8292582b740825c91aadf1e717b636409b30c7f8c123c.jpg)

## What Claude Code notification hooks actually do

[Claude Code](https://agentkit.best/blog/claude-code-guides/what-is-claude-code-a-complete-guide-to-the-ai-coding-tool) notification hooks are commands that run automatically when specific events happen. Instead of watching the terminal, you let Claude Code trigger a small script that sends a desktop alert when it needs your input.

This is best understood as lightweight CLI workflow automation, not a complex automation system. The goal is simple: Reduce terminal babysitting during normal development work.

### How the hook flow works

That is the core workflow: the event triggers, the match is found, and the command executes. Claude Code passes a small payload to the command, which your script can read and turn into a useful alert.

![Image](https://cdn.agentkit.best/blog/cfai-media/6fc1c4f80ffb6d3e28ff52b4898b97778ef458838b05e70cd537769207b93a59-4aa2585c965447b2963420e20acaa84232159d92309ae9a0d2c69f05c4355e02.jpg)

### Which Claude Code notification hook events matter most

For a first setup, two [**Claude Code hooks**](https://agentkit.best/blog/claude-code-guides/claude-code-hooks-guide-automate-and-control-ai-workflows) matter most:

These are the most practical **notification hooks** because they map directly to moments when you actually need to come back. If you have ever lost time glancing at the terminal every few minutes, this is where **Claude Code hooks** become useful. They improve workflow control without turning your local setup into an overbuilt event-driven system.

## The simplest Claude Code notification setup

The fastest working baseline is a small **settings.json configuration** plus one **notification script**. Start with the minimal version first. If that works, you can add nicer alerts later.

### Quick start

### Copy-paste hook configuration

Create or edit `.claude/settings.json` and add:

`{
  "hooks": {
    "Notification": \[
      {
        "matcher": "permission\_prompt|idle\_prompt",
        "hooks": \[
          {
            "type": "command",
            "command": "bash \\"$CLAUDE\_PROJECT\_DIR/.claude/hooks/notification.sh\\"",
            "timeout": 5
          }
        \]
      }
    \]
  }
}
`

This **settings.json configuration** tells Claude Code to run your script whenever either notification event appears. Using `$CLAUDE\_PROJECT\_DIR` keeps the path stable because it resolves to the current project root.

### What each config field means

A few practical notes matter here:

That last point saves the most time. Many hook issues are not hook issues at all. They are just script path or notification permission problems.

## Where to put the settings and script

Use project-specific settings when the workflow should stay with the repo. Use global settings when notifications are only a personal preference on your machine. That is the cleanest decision rule.

Project-level vs global setup:

![Image](https://cdn.agentkit.best/blog/cfai-media/ede0559b792987e39e64933b938accfb76754c82ea3954928a652a22d1d52e4f-7e33d5cec3c327cb0f9df5acc7c911b4f021c459d4fb96ba15eea3f5c7cfedb0.jpg)

For the script location, keep it predictable:

For most users starting out, a project-level setup is easier to understand because the config and script live together. But teams should not force personal notification behavior into version control unless that convention is discussed and accepted. A shared repo should optimize for maintainability, not surprise.

## A working macOS desktop notification script

For a first version, use osascript. It is built into macOS, needs no extra package, and is the simplest path to working macOS notifications.

### Example script

Create `.claude/hooks/notification.sh`:

`#!/bin/bash

input=$(cat)

if echo "$input" | grep -q '"notification\_type":"permission\_prompt"'; then
  osascript -e 'display notification "Claude Code needs your permission to continue." with title "Claude Code"'
elif echo "$input" | grep -q '"notification\_type":"idle\_prompt"'; then
  osascript -e 'display notification "Claude Code is waiting for your input." with title "Claude Code"'
fi
`

If needed, make it executable:

`chmod +x .claude/hooks/notification.sh
`

This notification script is intentionally minimal. It uses osascript to send a system notification and avoids unnecessary dependencies. It also stays focused on **permission\_prompt** and **idle\_prompt**, which is enough for a practical baseline.

### What this script is doing

That is enough for basic macOS notifications. Start here before you add anything more advanced. If the basic version fails, adding complex tools will complicate debugging. Stick to simplicity first.

To validate the script quickly, run the notification command manually in Terminal:

`osascript -e 'display notification "Test notification" with title "Claude Code"'
`

If no alert appears, the issue is not your hook logic. It is almost always macOS notification permission or system-level notification settings.

## Optional upgrades if the basic setup works

Only upgrade after the default setup is confirmed. A reliable basic desktop alert is more useful than a sophisticated setup you cannot trust. Useful upgrade path:

terminal-notifier is a reasonable next step if you want richer context, better formatting, or more control over presentation. But it should stay optional. Most users do not need it to get value from Claude Code notification hooks.

![Image](https://cdn.agentkit.best/blog/cfai-media/690446de133f324244cb0d7f83fa6c8635447b731cbe0a7bde74ceec9fe50f07-014282816d45f51cbc9f1413944811bca3abc43da820ad82a4a25f4df385cc07.jpg)

## Common issues and quick fixes

Most failures are simple and easy to isolate. In practice, the common causes are the same every time: Wrong file path, invalid JSON, missing notification permission, a bad script path, or a hook timeout that cuts things off too early.

Quick troubleshooting checklist:

![Image](https://cdn.agentkit.best/blog/cfai-media/1bdb70220b0eb4087aa04c1fa5499ac6d46c0478274888794953674e5dc40ebf-164b7598517f488560ca83c5610c15ddecf9b248989fb9efa14fda07ea450b0c.jpg)

A few plain failure patterns are worth calling out:

If you only remember one debugging rule, remember this one: Test the notification command manually first.

## When notification hooks are most useful in real workflow

Notification hooks are most useful when they reduce unnecessary checking without demanding a bigger system around them. The value is modest but real: Context switching reduction, better workflow control, and fewer interruptions while Claude Code runs in the background.

Practical use cases:

This is not about dramatic developer productivity claims. It is about removing a low-grade annoyance that repeats all day. If Claude Code frequently runs beside your normal work, notification hooks are one of the easiest quality-of-life improvements you can add.

![Image](https://cdn.agentkit.best/blog/cfai-media/ef3984a5625ed59eb3744ee2f1ba1d034fbbd2aad6855a72cb2d94b2d7ff8d8a-2644d728d88545178851a98cf16a77642779c3ae733ddf7b28f9017a69439ea5.jpg)

## Frequently asked questions

### What are Claude Code notification hooks?

Claude Code notification hooks are lightweight, event-driven commands that run automatically when specific lifecycle events occur, such as when Claude requires input. They allow you to receive desktop alerts, enabling you to focus on other tasks without constantly monitoring the terminal for prompts.

### How do I set up Claude Code notification hooks?

### Where should I store my notification settings?

Use project-specific settings (`.claude/settings.json`) if you want the workflow to travel with your repository and be shared with your team. Use global settings (`~/.claude/settings.json`) if the notification behavior is a personal preference that should apply to all your local Claude Code sessions.

### Why are my notifications not working?

If your notifications fail, check these common issues: ensure the file path in your `settings.json` is correct, validate your JSON formatting, confirm that your notification script has execution permissions, and verify that your macOS system settings allow notifications for the application triggering the alert.

### Can I upgrade my notifications after the basic setup?

Yes, but only after confirming the basic setup works. Once you have a functional alert, you can integrate advanced tools like `terminal-notifier` for better icons, play custom sounds to distinguish between event types, or add logic to display the current repository name or workspace context.

### Are these hooks better than checking the terminal?

Yes, they reduce context switching. Instead of manually checking the terminal every few minutes, you can work in another editor tab or review documentation. The notification system pulls your attention back to the terminal only when Claude Code explicitly requires your permission or input.

**Read more**:

## Conclusion

A good Claude Code notifications hook setup does not need to be elaborate. The best starting point is a small project-level config, a built-in osascript script, and support for permission\_prompt and idle\_prompt.

Start with the minimal path first. Confirm the command works manually, make sure notifications appear in macOS, and only then add upgrades like sounds or richer context. That order keeps the setup reliable and easy to debug.

If you are building more repeatable local agent workflows, explore the related Claude Code setup guides and reusable workflow templates on agentkit.best.
