Yes, you can use Growl notifications to alert you when command line tasks complete, and this guide shows you exactly how to set it up. You will learn the background of Growl, how to trigger notifications from a terminal, and how to choose the right method for your system. By the end, you will have a working setup that frees you from staring at a terminal window.
What Growl Is and Why It Matters
Growl is a notification system originally developed for macOS, first released in 2004. It was designed to give applications a unified way to display small, non-intrusive pop-up alerts on the screen, rather than each app having its own notification style. For many years, Growl was the standard for Mac notifications, and it supported a plugin system that allowed notifications to be delivered via sound, email, or even to a remote computer.
For command line users, Growl became a valuable tool because it provided a simple way to get notified when a long-running task finished. Instead of sitting and watching a build, a download, or a data processing script, you could run the command, walk away, and get a pop-up when it was done. This was especially useful before macOS introduced its own Notification Center in 2010, and before tools like terminal-notifier became common.
Today, Growl is less widely used, but it still works on older macOS versions and there are compatible alternatives for modern systems. The core concept—sending a notification from a shell script—remains relevant, and the techniques described here can be adapted to native macOS notifications or to Linux desktop notifications.
How Growl Notifications Work
Growl works through a client-server model. The Growl application runs in the background, and other apps (or scripts) send it a message using a protocol. The Growl server then displays the notification according to the user’s preferences (position, style, sound, etc.).
For command line use, you need a command-line tool that can send a message to the Growl server. The most common one is growlnotify, which is a command-line utility that comes with Growl. It sends a notification with a title, a description, and optionally an icon, a priority, and a sound. The basic syntax is:
growlnotify -t "Title" -m "Message"
For example, to notify when a build finishes, you could run:
make && growlnotify -t "Build" -m "Build completed successfully"
If the command fails, you might want a different message:
make && growlnotify -t "Build" -m "Success" || growlnotify -t "Build" -m "Failed"
You can also use growlnotify in a script that runs a long task and then sends a notification, regardless of exit status:
#!/bin/bash long_running_task growlnotify -t "Task done" -m "The task has finished"
Installing and Setting Up Growl
To use Growl notifications, you must first install Growl itself. On macOS, you can download Growl from the official website, but note that Growl 2.x is the last version and it requires macOS 10.8 or earlier. For newer macOS versions, Growl may not work properly because of changes in the operating system’s security and notification infrastructure.
If you are on an older Mac, here are the general steps:
- Download and install Growl from the official site.
- Open Growl and ensure it is running (it usually starts at login).
- Install the command-line tools. Growl includes
growlnotifyin its disk image; you can copy it to/usr/local/binor another directory in your PATH. - Test it by running
growlnotify -t "Test" -m "Hello"in the terminal.
If you are on Linux, you can use libnotify with notify-send instead of Growl. The concept is the same, but the command is different. For Windows, you might use notify-send or a PowerShell script with a toast notification. The rest of this article focuses on Growl, but the principles apply to any notification system.
Using Growl with Long-Running Tasks
The most common use case is to get a notification when a command finishes. Here are a few patterns you can use, depending on your needs.
- Simple completion: Run the command and then send a notification.
long_task; growlnotify -t "Done" -m "Task finished" - Success or failure: Use
&&and||to send different messages.long_task && growlnotify -t "Success" -m "It worked" || growlnotify -t "Failure" -m "It failed" - With duration: If you want to know how long it took, you can use the
timecommand or capture the start and end times in a script. - In a loop: If you are running multiple tasks in a loop, you can send a notification after each one, or only after the last one.
For example, a script that runs a backup and notifies you when it’s done:
#!/bin/bash rsync -av /source/ /backup/ growlnotify -t "Backup" -m "Backup completed"
You can also add a sound to the notification to make it more noticeable:
growlnotify -t "Backup" -m "Backup completed" -s
The -s flag plays the default sound. You can also specify a sound with --sound and a name.
Choosing the Right Tool for Your System
Growl is not the only option. Depending on your operating system and preferences, you might choose a different tool. Here is a comparison of common options:
- Growl (macOS 10.8 and earlier): Classic, works well, but outdated. Use
growlnotify. - terminal-notifier (macOS 10.9 and later): Sends notifications to the Notification Center. Works with modern macOS. Install via Homebrew:
brew install terminal-notifier. Usage:terminal-notifier -title "Title" -message "Message". - notify-send (Linux): Part of libnotify, works with most desktop environments. Usage:
notify-send "Title" "Message". - Windows Toast Notifications: Can be done with PowerShell or a small script. More complex, but possible.
If you are on a modern Mac, terminal-notifier is the recommended replacement for Growl. It is actively maintained and integrates with the native notification system. The syntax is similar, so the examples above can be adapted easily.
Common Problems and Solutions
When using Growl or similar tools, you might encounter a few issues. Here are the most common ones and how to fix them.
- growlnotify not found: Make sure the executable is in your PATH. You can check with
which growlnotify. If not, add the directory to your PATH or use the full path. - Notifications not showing: Ensure Growl is running. On macOS, check the menu bar for the Growl icon. Also, check Growl’s preferences to see if notifications are enabled for the application that is sending them.
- Notifications appear but no sound: Check the sound settings in Growl. You might need to select a sound for the notification style.
- Growl crashes or doesn’t work on newer macOS: Growl is not compatible with macOS 10.9 and later. Use
terminal-notifierinstead. - Script blocks until the task finishes: That is expected. If you want to run the task in the background and get a notification later, you can use
long_task &and then a separate script that waits for it, but that is more complex. For most cases, the simple approach is fine.
Frequently Asked Questions
Can I use Growl notifications for commands that run in the background? Yes, you can. If you run a command with &, the shell returns immediately, but you can still send a notification when the command finishes by using a subshell or a wrapper script. For example: (long_task; growlnotify -t "Done" -m "Finished") &
Is there a way to get a notification if the command fails? Yes, as shown above, you can use && and || to send different notifications based on the exit status. This is a common pattern for build scripts.
Do I need to install anything if I use terminal-notifier? Yes, you need to install it via Homebrew or download it from GitHub. It is a small command-line tool that sends notifications to the Notification Center.
Can I use Growl notifications on Linux? Growl itself is not available for Linux, but you can use notify-send which is the standard for desktop notifications. The concept is the same, and the command is simpler.
How do I make the notification stay on screen longer? In Growl, you can adjust the display duration in the Growl preferences. For terminal-notifier, you can use the -timeout option to specify how long the notification stays (in seconds).
Is there a way to send a notification to my phone? Growl has a plugin for Prowl, which forwards notifications to iOS devices. For modern systems, you can use Pushover or similar services, but that requires additional setup and an internet connection.
Related
Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.
More cards in this drawer
- Playwright Locators: Stable Tests Guide
- Batch to EXE: How to Convert & What Works5.00 min/km
- Lamborghini Less Tech Modernized?
- Passcode Protect Important Contacts? Yes, Here’s How
- Feature Phones UPI Payment Support: What to Know
- DNS Settings for Smoother Web Browsing