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.
First, you'll need to identify the actual executable. 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. To check you've found the right path, type it in the terminal - if TeamViewer starts, you've probably got it. Alternatively, open Activity Monitor while TeamViewer is running, identify the TeamViewer process and click 'Inspect' in the toolbar. Then, in the Open Files and Ports tab, the executable will likely be the first or second entry listed (after
Once you know what program you're tracking, you can create a
launchd Property List. 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. Create the following:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
Save this in
~/Library/LaunchAgents/some.meaningful.name.plist, then open a terminal and do:
launchctl load ~/Library/LaunchAgents/some.meaningful.name.plist
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. This will only run if your user is logged in. To run at boot, put the plist in
GroupName key/value pairs and use
sudo when running
launchd load. To get rid of the item (if you genuinely need to quit TeamViewer, for instance) simply replace load in the above command with unload.
Alternatively, Lingon provides a graphical interface to launchd, and may be easier.