Automatically relaunch a closed application
Here is my launchd script to keep SomeApp always running. It is in ~/Library/LaunchAgents/ and called SomeApp.restart.plist

&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"&gt;
&lt;plist version="1.0"&gt;
&lt;dict&gt;
        &lt;key&gt;RunAtLoad&lt;/key&gt;  
        &lt;true/&gt;  
        &lt;key&gt;KeepAlive&lt;/key&gt;
        &lt;true/&gt;
        &lt;key&gt;Label&lt;/key&gt;
        &lt;string&gt;SomeApp.restart&lt;/string&gt;
        &lt;key&gt;ProgramArguments&lt;/key&gt;
        &lt;array&gt;
                &lt;string&gt;/path/to/SomeApp.app/Contents/MacOS/SomeApp&lt;/string&gt;
        &lt;/array&gt;
&lt;/dict&gt;
&lt;/plist&gt;


Load it once with

launchctl load ~/Library/LaunchAgents/SomeApp.restart.plist


Launchctl will run this after reboots.


RunAtLoad will launch the application the first time launchctl runs this
KeepAlive will restart it if the application quits (CMD+Q or crash)


Should run forever. If you want a GUI tool to help, Lingon works even though development has stopped.