Trigger Notification Center Message using Mac Terminal Command


If you have a use case where you want to trigger a Notification Alert on your Mac using the terminal, you can do that using the osascript display notification command,

Example:
osascript -e 'display notification "Message!" with title "Title"'
Output:
Trigger Notification Center alert message using macOS Terminal Command
Trigger Notification Center alert message using macOS Terminal Command

You can also add subtitle to the notification using subtitle, example,

Notification with Subtitle
Notification with Subtitle
% osascript -e '
display notification "This is a test message!" 
with title "This is test Title" 
subtitle "This is subtitle"' 


















Copyright © Code2care 2024 | Privacy Policy | About Us | Contact Us | Sitemap