On Mac OS X, some applications will display a notification that appears briefly in the upper-right corner (e.g., when I receive email).

Is there a way to generate a notification from the command-line? In other words, is there a command-line program I can run to display a custom notification, with text of my choice? Ideally, I'd love to be able to run something like

show-notification "Hello world!"

from a shell script and have a notification appear showing the text "Hello world!".

I discovered I can use this answer to display a dialog box in the center of the screen that the user has to click "OK" on, but I'm looking for a notification not a modal dialog box.


1 Answer 1


The following works:

osascript -e 'display notification "Hello world!" with title "Hi!"'
  • 2
    You may also like to add sound name "default" at the end
    – arsenius
    Aug 24, 2017 at 4:55
  • 1
    I wonder if one could specify a custom image for the notification.
    – Kentzo
    Jul 27, 2018 at 18:53
  • Where can I read the official documentation about display notification? May 24, 2019 at 5:23
  • The language executed by osascript is "AppleScript", you can find the official docs here. You might want to have a look at man osascript as well
    – Qw3ry
    Mar 24, 2021 at 11:24

Not the answer you're looking for? Browse other questions tagged .