Show notification when app stops running

I've been using Raycast and sometimes it seems to quit.
Can I make KM send me a notification if Raycast quits?
Or, even better, be presented with a window like:
Do you want to restart Raycast? YES | NO

Please note that Raycast is not a "normal" app that's running in a window. It's active and only shows up in the top menu, just like KM. I guess this is important?

Presumably you've tried the application trigger?

As @noisneil mentioned, the application trigger is your friend here. It can be configured for when an application quits. It doesn't matter that an app is a menu bar only app; it will still fire.

Then you could place a prompt for user input action asking if you want it to restart etc. etc.


@iamdannywyatt This works for Alfred so it should work for Raycast.


Does it matter how an app quits, ie "quit" event vs crashes in a ball of digital flames?

@iamdannywyatt -- if the application trigger doesn't catch this for some reason and you want Raycast to be running all the time, write a LaunchAgent using the KeepAlive key. If you want it running all the time except when you deliberately quit it, use Crashed as well.

LaunchAgents sound scarier than they are -- there's a good info about them at


I don't believe so because I have a macro that is triggered when an app quits that triggers when it crashes.

I imagine this could be tested by simply killing the process from Activity Monitor to simulate a crash.

1 Like

I've tested in this way with the above macro and it works.


Just realised the If/Else was unnecessary, so I've removed it above.

Thanks. That worked like a charm!

1 Like

Thanks! I never used the Prompt before and when I opened it and saw the Variables, I thought it was just for that and would need a more complex workflow. So I guess it's just like a "Pause Until", but in this case it's "pause until the user clicks OK (because it doesn't have the Cancel Macro ticked) or clicks Cancel (because that's the one with the Cancel Macro ticked)".

That's cool!

1 Like

I actually had a LaunchAgent thing in the past to start an app automatically everyday, until I found KM.
This could be useful for when KM quits. For some weird reason (and I already started a thread here), KM's engine quits quite often when I open the Editor.

Do you know how to achieve the same result using the LaunchAgent? So when the Engine quits, it automatically restarts?

The only issue is that if I really want it to quit, for some reason, then it's on a loop... is there a way to also show a box where I can pick "OK" or "CANCEL"?

KME is a login item, not managed by launchd, so I'm not sure you can. You could have launchd run a script every 5 minutes that checked whether KME was running and, if not, relaunched it. But I think you'd be better off curing the quitting problem rather than slapping a Band-Aid over things.

1 Like

Thanks. The 5 minute script wouldn't work for me, because the issue is that when I open the app, it quits (sometimes) so I would need it to start right away, because I don't always see that it quit.

I tried figuring out what the problem was, but since it's super random, it's hard to do it. If it was quitting every single time, I could maybe see if there was a macro that was causing that. Since it's random, it's not straight forward...

I'll find a way. Thank you!

5 minutes was just an example. But, obviously, the more often you check the more resources you are using up and, at some point, it becomes much more efficient to simply leave the KM Editor running so you rarely have to launch it and so you don't crash the Engine!

Yes, I know you worry about KM using up resources and conflicting with other things and so on. But modern Macs are very good at managing such things -- you can leave KM running all day every day in the background and not notice it's there. Try it -- "Hide" KM, launch Activity Monitor, make a note of KM's CPU and energy usage etc, then check after 24 hours of not using the Editor. You'll see the numbers have barely changed.

But, coz it's fun, I'll see if I can do a LaunchAgent to relaunch KME on crashing.

1 Like

Yes, I got that, but any amount of time would require it to be running all the time and the "perfect" time would be every second, which is not ideal, of course.

There are 2 reasons for not leaving the editor open. One, is that I rarely use KM so having another app running, even if it doesn't take any resources, is just another app that shows up, for example, when I'm using the App Switcher (CMD+Tab).
Two, I like to just keep everything closed if I don't need them. Sure, there's the resources thing for certain apps, but in general I like to keep everything "clean" in my workspace. It's just an "OCD" thing. When I have too many windows and apps, sometimes I can't even function properly. Sometimes I just close everything and start all over so I can keep track of what I am actually doing. Just a personal choice.

If you can, that would be awesome :slight_smile: I appreciate it!