Skip to content

🦊 Send native macOS User Notifications from the command line with a lightweight Swift 6 CLI

License

Notifications You must be signed in to change notification settings

FlorianBx/notify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

11 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Notify

Swift

A modern Swift CLI tool for sending macOS User Notifications from the command line. Inspired by the excellent terminal-notifier project, this Swift 6 implementation maintains compatibility with most commands while leveraging modern macOS frameworks.

Features

  • Send rich notifications with title, subtitle, and message
  • Custom notification sounds
  • App activation and URL opening
  • Notification removal and listing
  • Native Swift implementation using UserNotifications framework
  • Universal binary support (Apple Silicon)

Requirements

  • macOS 13.0 (Ventura) or later
  • Swift 6.0+ (for building from source)

Installation

Homebrew (Recommended)

brew install notify

Manual Installation

curl -fsSL https://raw.githubusercontent.com/florianbx/notify/main/install.sh --install | bash

Build from Source

git clone https://github.com/florianbx/notify.git
cd notify
make install

Usage

Basic notification

notify --message "Hello World!"

Rich notification

notify --title "Build Complete" --subtitle "MyApp" --message "The build finished successfully"

With sound

notify --message "Task completed" --sound "Glass"

Available sounds

System sounds available on all macOS systems:

  • Basso, Blow, Bottle, Frog, Funk, Glass, Hero, Morse, Ping, Pop, Purr, Sosumi, Submarine, Tink

Examples:

notify --message "Build finished!" --sound "Hero"
notify --message "Error occurred" --sound "Basso" 
notify --message "New message" --sound "Ping"

Note: Additional sounds may be available depending on your macOS version. All system sounds are located in /System/Library/Sounds/.

Open URL on click

notify --message "Check this out!" --open "https://github.com"

Activate specific app

notify --message "Ready for review" --activate "com.apple.Safari"

List delivered notifications

notify list

Remove all notifications

notify remove --all

Remove notifications by group

notify remove --group "MyGroup"

Note: For backward compatibility with terminal-notifier, the legacy flag syntax (notify --list and notify --remove GROUP) is also supported when using the send command, but the subcommand syntax shown above is preferred.

Development

Building

make build

Testing

make test

Installing development version

make dev-install

Creating release

make release

Architecture

This tool is packaged as a macOS app bundle (.app) to comply with the UserNotifications framework requirements. The CLI binary is located at:

notify.app/Contents/MacOS/notify

The Homebrew formula creates a symlink from /usr/local/bin/notify to the binary inside the app bundle.

Compatibility with terminal-notifier

This tool is inspired by and compatible with most terminal-notifier commands. If you're coming from terminal-notifier, most of your existing scripts should work with minimal changes - just replace terminal-notifier with notify.

Key differences:

  • Binary name: terminal-notifier β†’ notify
  • Requires macOS 13.0+ (vs 10.10+ for terminal-notifier)
  • Built with modern Swift and UserNotifications framework
  • Some advanced options may have slight differences

Credits

This project is inspired by the excellent terminal-notifier by Julien Blanchard. Many thanks for creating such a useful tool that has served the macOS community for years!

License

MIT License

About

🦊 Send native macOS User Notifications from the command line with a lightweight Swift 6 CLI

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Packages

No packages published