Introduction
When working with Claude Code on macOS, you might find yourself waiting for long-running tasks to complete or missing important prompts for user input. The terminal-notifier
utility provides an elegant solution by sending desktop notifications directly from the command line, helping you stay informed about your Claude Code sessions even when you’re focused on other tasks.
Note: I decided to use terminal-notifier
both because I can customise the notification I receive and also because my setup was having issues and I didn’t always get notifications from my terminal.
What is terminal-notifier?
terminal-notifier
is a command-line tool for macOS that allows you to send user notifications from the terminal to the Notification Center. It’s particularly useful for automation scripts and development workflows where you need to be alerted about specific events.
Installing terminal-notifier
The easiest way to install terminal-notifier
is through Homebrew:
|
|
Using terminal-notifier with Claude Code
Claude Code can be configured to use terminal-notifier
for sending notifications in different ways. The most realiable (and deterministic)
is using the new /hooks
feature. Add this configuration to your ~/.claude/settings.json
:
|
|
The other method (not deterministic, but you can customise the message you get)
is to add instructions to your global or project-specific CLAUDE.md
file:
|
|
Save the file and start a new Claude Code session.
Final result
If everything worked, once Claude has finished elaborating a task, you should get a notification like this:
Troubleshooting
Notifications Not Appearing
- Check that notifications are enabled for Terminal in System Preferences > Notifications
- Ensure
terminal-notifier
is properly installed and in your PATH - Try running a test notification manually to verify functionality:
terminal-notifier -title "Hello" -message "World!"
Conclusion
Integrating terminal-notifier
with Claude Code creates a more efficient and responsive development workflow. By receiving timely notifications about task completion and input requests, you can maintain focus on other work while staying connected to your Claude Code sessions.
The combination of Claude Code’s automation capabilities with macOS’s native notification system provides a seamless development experience that keeps you informed without being intrusive.