This will cause launchd to load the item which will cause it to monitor the specified program and, if it exits for any reason, it will be re-started. Save this in ~/Library/LaunchAgents/, then open a terminal and do: launchctl load ~/Library/LaunchAgents/
This is an XML file, so you can do it with your favourite text editor or alternatively you can use the Property List Editor that's installed with the Mac OS X Dev Tools. Once you know what program you're tracking, you can create a launchd Property List. Then, in the Open Files and Ports tab, the executable will likely be the first or second entry listed (after /). Alternatively, open Activity Monitor while TeamViewer is running, identify the TeamViewer process and click 'Inspect' in the toolbar.
To check you've found the right path, type it in the terminal - if TeamViewer starts, you've probably got it. Open a terminal and look around in the TeamViewer bundle - the executable will likely be at /Applications/TeamViewer.app/Contents/MacOS/TeamViewer but your mileage may vary. You don't need to reboot to re-start TeamViewer you can get launchd to monitor the process and re-start it if it crashes.įirst, you'll need to identify the actual executable.