Ensure specific app is always running

I'm trying to find a way to ensure that the TeamViewer remote access program is always opening/running on my iMac. TeamViewer has to be open/running on a computer for me to be able to remotely access that particular machine. Several times over the last couple months I've accidentally quit TeamViewer, or the program unexpectedly quit, and I only first found out about this when I was away from my home computer trying to remotely access it.

Ideally, I'd like a macro that periodically checks to make sure the TeamViewer is running, and if it is not, then it should open the program and immediately minimize it to the dock so it doesn't get in the way of whatever I might be doing at the time.

The macro would need to allow enough time between its periodic checks to allow my computer to restart (I once tried setting up a macro like this that checked every 5 seconds whether TeamViewer was running, and I couldn't even restart my computer because KM kept relaunching TeamViewer over and over again before I could complete a restart cycle).

Also, if and when TeamViewer does relaunch via the macro, how can I have it promptly minimize to the dock so as not to get in my way (without needing to 'Pause' for a specific number of seconds before issuing the Cmd+H hide command)?

I know that there must be clean clean way of creating a macro like this, but I certainly can't figure out what that might be on my own ~here's a screenshot of my attempt at creating a macro to accomplish this task:

Pretty ugly I know!

I would sincerely appreciate any help anyone might be able to give me with creating a macro to more seamlessly accomplish the task at hand. Thanks so much!

Hi Micah

I think there is a way to setup Teamviewer to always run in the background. This is done in Teamviewer. When I am at a computer I will look into it.

\ Jimmy Hartington

When Teamviewer is running, go to the menu “Connection”.
Choose “Setup Unattended access …” and follow the instructions.

I’ve done that, but if you accidentally hit Cmd+Q, the program quits and there is no background service that keeps you ‘connectable’ (like there is with LogMeIn)…

… and I did you run into at least 3 separate times when the application simply quit unexpectedly for no obvious reason (and I was away from home and in need of remotely connecting each of the 3 times that this happened)… Hence my thoughts on coming up with a KM macro to act as a triple fail safe solution. It works, but my macro is sloppy and I wondered if anyone else could do better.


I’m showing this workflow in my Work macro. Personally I would recommend to setup a Launch Service instead. This is much more error prone and doesn’t rely on a third party app like Keyboard Maestro. As much as I love KM, but there are certain things where I think the app is inappropriate to use. In this particular case, the other computer is supposed to have the remote program running at all time. With Keyboard Maestro, you have to make sure that Keyboard Maestro is also running all the time. With a Launch Service there’s an “keep running” option. Launch Control is a nice, and free, GUI to setup Launch Services.