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!"'

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