gitmyhub

terminal-notifier

Objective-C ★ 7.2k updated 7mo ago

Send User Notifications on macOS from the command-line.

terminal-notifier is a macOS command-line tool that lets shell scripts and programs send native desktop notifications, so you can be alerted when a long-running task finishes or an automated script needs your attention.

Objective-Csetup: easycomplexity 1/5

terminal-notifier is a command-line tool for macOS that lets scripts and programs send desktop notifications. When you run a long command in the terminal and want to be alerted when it finishes, or when an automated script needs to signal something, terminal-notifier can pop up a macOS notification in the top corner of the screen, the same kind you see from calendar reminders or messages.

The tool accepts a message as either a command-line argument or piped input from another program. You can set the notification title, subtitle, and body text. Additional options let you attach a sound, specify a custom icon, include an image inside the notification, and control what happens when the user clicks it: open a URL, launch an application, or run a shell command.

Notifications can be assigned a group ID, which means only one notification per group is shown at a time. A new notification replaces any existing one with the same group ID. This is useful for build-status alerts or sync notifications where stacking many notices would be distracting. You can also list or remove notifications by group ID from the command line.

The tool is distributed as a macOS application bundle. You can install it via Homebrew or download a prebuilt binary from the releases page. A Ruby gem wrapper is also available that adds a simpler command so you do not need to type the full path into the app bundle each time.

The README notes that sticky notifications (ones that stay on screen until manually dismissed) are not supported here; it points to a separate project called alerter for those cases. terminal-notifier requires macOS 10.10 or newer and is released under the MIT license.

Where it fits