Send User Notifications on macOS from the command-line
open sourceMITself-hostablefree
terminal-notifier is a command-line tool that sends macOS user notifications, so scripts and long-running commands can tell you when they finish. Notifications can have a title, subtitle, sound, image and group, open a URL, run a command or bring an app forward when clicked, offer action buttons or a reply field, and be scheduled for later. Version 3 is rebuilt on Apple's UserNotifications framework, needs macOS 10.14 or later, and ships as an app bundle. A Ruby gem bundles the binary.
Ways to install
Package managers
Problems it solves
- get a Mac notification when my long build or test run finishes
- show a desktop notification from a shell script on macOS
- open a URL or run a command when I click a notification from my script
- schedule a notification for later from the terminal
- ask a yes or no question through a notification with action buttons from a script
- replace an old notification instead of stacking up a new one each time
- send Mac notifications from my Ruby code
Features
- title, subtitle, message, sound and content image
- message from standard input
- groups: replace, list and remove notifications
- click actions: open a URL, execute a command, activate an app
- action buttons and reply field
- scheduling with -in and -at, and cancelling scheduled notifications
- -diagnose to explain why notifications don't appear
- custom icons through a custom copy of the app bundle (make icon)
- Ruby gem
Limitations
- Can't set a different icon per notification: macOS has no API for it and the icon always comes from the sending app bundle2
- Doesn't bypass Do Not Disturb or Focus: -ignoreDnD was effectively removed in 3.0.02
- Downloaded copies aren't notarized: macOS quarantines them until you clear the quarantine attribute2
Capabilities
| Has a command line tool | plan not known |
|---|---|
| Has official SDKs | plan not known |
