0

I am trying to create a plist for a unix executable. The executable works perfectly well when I run it in Terminal. However I simply cannot get it to run from launchd. Here are the steps I took:

sudo touch /Library/LaunchDaemons/Parity.plist

sudo nano /Library/LaunchDaemons/Parity.plist

Then I input the following data:

<?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">
  <plist version="1.0">
    <dict>
      <key>Label</key>
        <string>Parity</string>
      <key>ProgramArguments</key>
        <array>
          <string>/usr/local/Cellar/parity/1.5.12/bin/parity</string>
          <string>start</string>
        </array>
      <key>RunAtLoad</key>
        <true/>
      <key>KeepAlive</key>
        <true/>
   </dict>
</plist>

If I run:

sudo launchctl load /Library/LaunchDaemons/parity.plist

I get the response:

/Library/LaunchDaemons/Parity.plist: service already loaded  

Does anyone have any suggestions?

  • you have to unload it first: sudo launchctl unload... then load it again sudo launchctl load... – Allan Apr 1 '17 at 17:47
  • @Allan Thanks for your reply. I followed your advice, but it unfortunately has not made any difference. Do you have any other ideas? – AlexanderSupersloth Apr 1 '17 at 17:52
  • Try removing it sudo launchctl remove... to remove it. Then reload. – Allan Apr 1 '17 at 18:03
  • @Allan Unfortunately that didn't work either. However I have found that when I run launchctl list I get - 1 Parity. Everything else has a 0 next to it. – AlexanderSupersloth Apr 1 '17 at 18:26
  • 1
    Glad I could help. Post your solution as an answer so you can "accept it" and I can vote you up for some reputation points. – Allan Apr 2 '17 at 1:45
1

It turns out that the cause of the error was a poorly written plist - <string>start</string> was instructing the exec file to run a start command when initiating the daemon, which was causing it to crash. I erased that line from the plist and now it behaves as I had intended.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .