title: launchd does not 'keep alive' processes in El Capitan
body: <p>I'm trying to make sure a process is always running, even after it quits, crashes or stops in anyway. It's a small binary that reads a serial line and writes to a database - nothing too complex. If it fails to read, it quits with exitcode 70 and it captures any SIGKILL or SIGTERM events and shuts down it's database connections gracefully before actually quitting.</p>
  
  <p>However, the process does NOT launch at load (even though this flag is set), nor does it restart if it is killed. Here is the plist:</p>
  
  <pre><code>&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;Disabled&lt;/key&gt;
      &lt;false/&gt;
      &lt;key&gt;KeepAlive&lt;/key&gt;
      &lt;true/&gt;
      &lt;key&gt;Label&lt;/key&gt;
      &lt;string&gt;blah.bloop.tag05&lt;/string&gt;
      &lt;key&gt;ProgramArguments&lt;/key&gt;
      &lt;array&gt;
          &lt;string&gt;/Users/blah/Desktop/rfid&lt;/string&gt;
          &lt;string&gt;-f/dev/tty.usbserial-FT32X30YBXB&lt;/string&gt;
          &lt;string&gt;-n5&lt;/string&gt;
          &lt;string&gt;-ctcp://127.0.01&lt;/string&gt;
          &lt;string&gt;-v&lt;/string&gt;
          &lt;string&gt;-x100000&lt;/string&gt;
      &lt;/array&gt;
      &lt;key&gt;RunAtLoad&lt;/key&gt;
      &lt;true/&gt;
      &lt;key&gt;StandardErrorPath&lt;/key&gt;
      &lt;string&gt;/var/log/rfid.log&lt;/string&gt;
      &lt;key&gt;StandardOutPath&lt;/key&gt;
      &lt;string&gt;/var/log/rfid.log&lt;/string&gt;
      &lt;key&gt;WorkingDirectory&lt;/key&gt;
      &lt;string&gt;/Users/blah/Desktop&lt;/string&gt;
  &lt;/dict&gt;
  &lt;/plist&gt;
  </code></pre>
  
  <p>This plist lives in ~/Library/LaunchAgents (and the user in question can stop and start this process easily enough).</p>
  
  <p>Any thoughts at all? I know there are other processes that are being restarted but I can't for the life of me figure out this one. I thought permissions might be it but these all seem fine :/</p>
  
  <p>I decided to try another plist to see if it was my daemon program at fault. Turns out, it's launchd:</p>
  
  <p>So I decided to run a quick test, using the program tail. I wanted to see if it was my daemon process itself or something to do with launchd. It seems that launchd is the problem. Here is an alternative and simple plist:</p>
  
  <pre><code>&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;KeepAlive&lt;/key&gt;
          &lt;true/&gt;
          &lt;key&gt;Label&lt;/key&gt;
          &lt;string&gt;test.test&lt;/string&gt;
          &lt;key&gt;ProgramArguments&lt;/key&gt;
          &lt;array&gt;
                  &lt;string&gt;/usr/bin/tail&lt;/string&gt;
                  &lt;string&gt;-f&lt;/string&gt;
                  &lt;string&gt;/var/log/system.log&lt;/string&gt;
          &lt;/array&gt;
          &lt;key&gt;RunAtLoad&lt;/key&gt;
          &lt;true/&gt;
          &lt;key&gt;StandardErrorPath&lt;/key&gt;
          &lt;string&gt;/tmp/test.test.err&lt;/string&gt;
          &lt;key&gt;StandardOutPath&lt;/key&gt;
          &lt;string&gt;/tmp/test.test.out&lt;/string&gt;
  &lt;/dict&gt;
  &lt;/plist&gt;
  </code></pre>
  
  <p>I launch this process using the following command</p>
  
  <pre><code>launchctl load test.plist
  launchctl start test.test
  </code></pre>
  
  <p>I then kill the process from another terminal by sending either SIGKILL or SIGTERM to the process with the kill command. Launchd fails to restart the process.</p>
  
  <p>I suspect there must be something new in El-Capitan that I've missed?</p>