Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top


I'd like to be able to display a notification window in OS X from within a script. The script will be running in background, so the notification should not go to the terminal but instead be displayed in a dialog window.

What I found so far


On Linux I'd probably use xmessage or one of its variants for this. But on OS X, starting the bulky X server just for this task seems both overkill and too slow for my taste.

Finder dialog

I've found a similar question in this forum thread, where the “accepted” reply suggested this command:

osascript -e 'tell app "Finder" to display dialog "Hey!"'

But on my OS X , the resulting dialog isn't displayed immediately. Instead, the Finder icon starts to bounce, and the dialog becomes visible only after I click on the icon. Too many mouse clicks, too disruptive.


There is an answer on Super User which suggests a tool called terminal-notifier. Unfortunately that appears to only work for OS X , so it won't help in my case.


So is there some tool, either included in OS X or freely available, which allows displaying a small dialog to the user without too much overhead?

share|improve this question
up vote 3 down vote accepted

One option is to tell a background process like SystemUIServer to display the dialog:

osascript -e 'tell application "SystemUIServer"
display dialog "message"
activate application (path to frontmost application as text)'

You can also tell the frontmost application to display a dialog, but it's not shown immediately if the application is not responding. If MPlayer OS X is frontmost, text dialogs don't accept any keyboard input.

osascript -e 'tell application (path to frontmost application as text)
display dialog "message"
share|improve this answer
The first approach has the drawback that it will raise all windows of the given application, which I find slightly annoying. But the second approach is the best I've seen so far. Apps not responding should be rare enough that I won't worry about these. – MvG Nov 30 '12 at 12:18


tell application "System Events" to display dialog "Plug the Digispark into the USB port." buttons {"OK"} with icon caution

Tested on OS X 10.8.2

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.