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?
Best Answer
It turns out that the cause of the error was a poorly written plist -
<string>start</string>
was instructing the exec file to run astart
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.