on-demand launch agent restarting automatically As title says I have created a on-demand launch agent that listens to socket and is launched on incoming connection. It works well and after it has done it's job I want to quit it. After quitting system automatically restarts it, OS probably thinks it died accidentally. How can I stop this behaviour? My launch agent is a Cocoa application (without GUI), I have tried quitting with 'exit(EXIT_SUCCESS)' and '[[NSApplication sharedApplication] terminate:self]'

My launchd plist is below:

&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;Label&lt;/key&gt;
&lt;string&gt;com.mycompany.mylaunchagent&lt;/string&gt;
&lt;key&gt;ProgramArguments&lt;/key&gt;
&lt;array&gt;
    &lt;string&gt;/Library/Application Support/com.mycompany.myproduct/myproduct.app/Contents/MacOS/myproduct&lt;/string&gt;
&lt;/array&gt;
&lt;key&gt;ServiceIPC&lt;/key&gt;
&lt;true/&gt;
&lt;key&gt;KeepAlive&lt;/key&gt;
&lt;false/&gt;
&lt;key&gt;Sockets&lt;/key&gt;
&lt;dict&gt;
    &lt;key&gt;MyListenerSocket&lt;/key&gt;
    &lt;dict&gt;
        &lt;key&gt;SockServiceName&lt;/key&gt;
        &lt;string&gt;12040&lt;/string&gt;
    &lt;/dict&gt;
&lt;/dict&gt;
It probably won't help, but you could try sleeping for a few seconds before exiting. From Daemons and Services Programming Guide:


  Important: If your daemon shuts down too quickly after being launched, launchd may think it has crashed. Daemons that continue this behavior may be suspended and not launched again when future requests arrive. To avoid this behavior, do not shut down for at least 10 seconds after launch.