Mac – LaunchDaemon not recognised

launchdmacports

I've installed CouchDB via MacPorts. Now I want to start it when my Mac boots, so I executed the instructions given in the install process:

sudo launchctl load -w /Library/LaunchDaemons/org.apache.couchdb.plist

However this doesn't seem to work. I've looked inside the LaunchDaemons directory, and the plist file is there (as a symlink):

lrwxr-xr-x  1 root  wheel   57 18 aug 10:11 org.apache.couchdb.plist -> /opt/local/Library/LaunchDaemons/org.apache.couchdb.plist

The contents of the actual plist file seem ok (however I have no real knowledge of how it should look):

<plist version="1.0">
  <dict>
    <key>Label</key>
    <string>org.apache.couchdb</string>
    <key>EnvironmentVariables</key>
    <dict>
      <key>HOME</key>
      <string>~</string>


    </dict>
    <key>ProgramArguments</key>
    <array>
      <string>/opt/local/bin/couchdb</string>
    </array>
    <key>UserName</key>
    <string>couchdb</string>
    <key>StandardOutPath</key>
    <string>/dev/null</string>
    <key>StandardErrorPath</key>
    <string>/dev/null</string>
    <key>RunAtLoad</key>
    <true/>
    <key>KeepAlive</key>
    <true/>
  </dict>
</plist>

When I execute /opt/local/bin/couchdb manually, the process is created, so no problems there. It just seems the launch daemon skips this command.

Any thoughts on how to fix this?

Best Answer

Try the following (one-line command) :

sudo chown -R couchdb:couchdb /opt/local/var/lib/couchdb/ /opt/local/var/log/couchdb/ /opt/local/etc/couchdb/ /opt/local/var/run/couchdb

Then reboot.

If it doesn't work, what version of MacPorts and CouchDB do you have ?