Launch application if it is not running

I want my application Launchbar to always be running, I can set a script up that triggers on if LB quits, but I want it to trigger even if LB hasn’t yet been launched, and I can’t figure out what the trigger condition should be.

The only thing that seems promising is “periodically while logged in” but I am super hesitant to use that as it feels like if I checked every 10 seconds that would 1) be bad 2) interfere with shutdowns.

Also, is there a way to tell if the application has stopped responding? (It doesn’t happen often, but it does happen).

We need more info to be helpful.
Why does LaunchBar quit? Once you launch it at the start of the day, it should continue to run unless you quit it.

I have two macros that I use daily to launch and quit my apps:

  1. On Wake – triggered by Mac wake or startup
  • Launches my std set of apps
  1. Sleep – triggered by name manually
  • Quits all apps and then puts the Mac to sleep

These work quite well. I rarely have an app unexpectedly quit. If I do, I use LaunchBar to launch it – fast and easy. To launch LaunchBar I use Spotlight.

You could have a macro to launch LaunchBar if it quits. Then use a sleep macro to disable this macro, or deactivate its group, when it is run, and then enable/activate it at the very end of the macro.

I feel like you may be overthinking this problem a bit. The only reason you would want LaunchBar to always be running is so that it responds when you hit its shortcut, right? In that case, if a macro that launches LaunchBar automatically when LB quits isn't sufficient for your needs, why not also use a macro like this that's bound to the same shortcut that you use for LaunchBar? This way, you can ensure that hitting LB's shortcut will always activate it, whether it's running or not, without relying on a macro that's constantly pinging your system to check for a condition that should only occur rarely.

Activate LaunchBar if not Running.kmmacros (2.7 KB)


Very clever, @gglick. :+1:

At first I thought LB might not activate when it IS running since KM has grabbed its hotkey. But I tested and it does work fine. I forgot that when a global hotkey is pressed, ALL apps will respond to it.

As a minor enhancement you could put this macro in a Group that excludes LB:

1 Like

Launchbar has many shortcuts, not just one (⌘-space, ⌘-⌥-space, ⌘-⇧-Space, ⌘⇧-, double ⌘-C, and many others) . And sometimes (not often, but sometimes) it crashes or gets quit accidentally or it goes into “Not responding” mode. I haven’t figured out a way around the last one, but so far checking every 30 seconds and checking when it quits and relaunching it seems to be working.

Just in case you weren't aware, a single macro can easily have multiple triggers:

If you're happy with your current solution and don't mind the continuous pinging on your system, then more power to you. I would just encourage you, and anyone else running into this problem, to try and see if there are any alternative, possibly more efficient solutions first.


I would also add a duplicate of the keystroke in the macro, so that invoking your keystroke once will a) launch LaunchBar if not running and then b) hit the keystroke for you again. :wink:

Hi @lbutlr, some tips:

sometimes (not often, but sometimes) it crashes

I’m using LaunchBar for many years and I know, sometimes it dies silently. But on my machine this happens maybe once every couple of weeks.

Since you are considering a hefty check interval of 30 seconds, I assume that LaunchBar dies much more frequently on your machine. This is definitely not “normal” and I would rather investigate the problem than building a relaunch macro.

or gets quit accidentally

In LaunchBar’s Preferences > Shortcuts you can set it to quit only on ⌥⌘Q (instead of ⌘Q). This should help.

or it goes into “Not responding” mode

The main thing that causes trouble for LaunchBar is an overcrowded index. Do not try to index everything with LaunchBar, you have Spotlight for that.

If not already done, thin out the index and try to reduce the amount of indexed files and folders to something less than 10000 items (currently I have about 5000, and this is still more than it could be if further optimized). Also disable iTunes indexing if you don’t need it, and similar stuff.

Indeed, it will take an hour or two to build a compact and meaningful index, but LaunchBar will thank you by being very snappy and responsive and – above all – CPU usage (energy consumption) will be greatly reduced, which is essential when you are on a notebook.