First off: Im absolutely new to Mac, so the problem might be really really basic.

I have been trying to set up a Launchd Daemon to run at startup to run a Service via Mono.Frameworks. I used Lingon to create the .plist file

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"  "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<string>Worker Container</string>

The command to start the service does work fine when run manually

It does however not start automatically on startup. Any help? Im really stuck since this is the first time Im using a Mac.



Launchd is freaky about permissions. If it's not owned by root:wheel, with permissions set to 600, it will most likely not do anything with that plist at startup, regardless of how you load it, or what it says inside.. You may notice a log entry about "Dubious Permissions" in such a case. If this is the problem...

sudo chown root:wheel /Library/LaunchDaemons/org.saveusfromlaunchctl.sucks.plist
sudo chmod 600 /Library/LaunchDaemons/org.saveusfromlaunchctl.sucks.plist
sudo launchctl unload -w /Library/LaunchDaemons/org.saveusfromlaunchctl.sucks.plist
sudo launchctl load -w /Library/LaunchDaemons/org.saveusfromlaunchctl.sucks.plist

Another little publicized fact about LaunchDameons is the shady smorgasbord of launchd preferences in the sanctuary of


if you've got an entry in any of those overrides.plist's with


That sucker ain't never gonna launch.

  • upvote for you sir. saved an un-bootable install! – OrangeBox Jan 18 '12 at 23:51

Launchd expects the programs it launches not to daemonize themselves; if they do, launchd detects it as the program exiting, and cleans up all subprocesses (i.e. kills the now-daemonized program). Depending on the daemon's start and/or keepalive conditions, it might then relaunch it, and do the whole thing over and over again. In this case, I think all you need to do is add <string>--no-daemon</string> to the ProgramArguments array.

A few more (less critical) changes I'd make: first, lose the sudo -- it's not needed (launchd runs daemons as root unless told to do otherwise), and if it were needed it wouldn't work (it needs to prompt for a password, and there's nobody available in daemon context). Second, the WorkingDirectory key and -d argument seem to do exactly the same thing; there's no point in using both. Finally, you might want to add <key>KeepAlive</key><true/>, so that if the service does crash it'll get relaunched automatically.

  • 1
    You can also use <key>AbandonProcessGroup</key><true/> to instruct launchd not to kill the child processes if you want to allow programs to daemonize themselves. – Courtney Faulkner Apr 19 '11 at 19:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.