explaingit

julienxx/terminal-notifier

7,179Objective-CAudience · developerComplexity · 1/5LicenseSetup · easy

TLDR

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.

Mindmap

mindmap
  root((repo))
    What It Does
      Send Mac notifications
      Alert on task finish
      Group notifications
    Options
      Title and subtitle
      Sound attachment
      Click to open URL
      Click to run command
    Install Options
      Homebrew
      Prebuilt binary
      Ruby gem wrapper
    Audience
      Mac developers
      Shell scripters
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Send a desktop notification when a long-running build, test suite, or deployment script finishes in the terminal

USE CASE 2

Alert yourself from an automated backup or sync script when the task completes or encounters an error

USE CASE 3

Group build-status notifications by ID so each new result replaces the previous one instead of stacking

Tech stack

Objective-C

Getting it running

Difficulty · easy Time to first run · 5min

Requires macOS 10.10 or newer, install via Homebrew or download a prebuilt binary from the releases page.

Use freely for any purpose, including commercial use, as long as you keep the copyright notice.

In plain English

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.

Copy-paste prompts

Prompt 1
Show me the terminal-notifier command to send a desktop notification with a custom title, subtitle, and sound when my build script finishes
Prompt 2
How do I use terminal-notifier with a group ID so that each new build-status notification replaces the previous one instead of piling up?
Prompt 3
What terminal-notifier flag opens a specific URL in the browser when the user clicks the notification?
Open on GitHub → Explain another repo

← julienxx on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.