Is Mathematica able to communicate with macOS's native Notification Center in order to notify me if an evaluation finishes in any of my open notebooks?

I'm looking for a solution similar to this one except it shouldn't rely on Growl.

enter image description here


1 Answer 1


A quick Google search returned:

Based on this, we can use

notify[asc_] := 
 RunProcess[{"osascript", "-e", 
   StringTemplate["display notification \"`message`\" with title \"`title`\""][asc]}]

notify[<|"message" -> "I'm finished!", "title" -> "Mathematica"|>]

You can customize this further to your needs.

  • $\begingroup$ I don't know. The linked thread says 10.9. It works for me on 10.12. Output is as expected. $\endgroup$
    – Szabolcs
    Commented Oct 30, 2017 at 14:08
  • $\begingroup$ Changing Mathematica settings is not necessary because all this does is it runs an AppleScript (see the linked post!) As for showing notifications after every evaluation: see CellEpilog from the thread that you yourself linked. You might try to set this in the stylesheet. $\endgroup$
    – Szabolcs
    Commented Oct 30, 2017 at 14:23
  • 3
    $\begingroup$ I run in macOS 10.13 notify[asc_] := RunProcess[{"osascript", "-e", StringTemplate[ "display notification \"message\" with title \"title\""][ asc]}, "StandardOutput"] notify[<|"message" -> "I'm finished!", "title" -> "Mathematica"|>], and it works in MMA 11.2. It gives me a notification. $\endgroup$ Commented Oct 30, 2017 at 14:27
  • $\begingroup$ (+1) It's too bad osascript doesn't allow you to change the icon. $\endgroup$
    – Greg Hurst
    Commented Oct 30, 2017 at 18:04
  • 2
    $\begingroup$ @Szabolcs Please excuse my stupidity. The notifications do in fact work perfectly. I had "Do Not Disturb" enabled yesterday and had completely forgotten about it. $\endgroup$
    – Janosh
    Commented Oct 31, 2017 at 20:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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