I'm trying to figuring out why my daemon doesn't be launched automatically (on Mac 10.8.3). However, it works well on other machines. Here is my plist under /Library/LaunchDaemons/

<?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">
  <dict>
    <key>Label</key>
    <string>com.MyApp.tmsm.launcher</string>
    <key>ProgramArguments</key>
    <array>
        <string>/Library/Application Support/MyApp/tmsmLauncher</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
    <key>KeepAlive</key>
    <false/>
    <key>StartInterval</key>
    <integer>60</integer>
  </dict>
</plist>

I didn't see any error messages in /var/log/system.log. I have checked the permission and owner of my daemon. If i put my plist under /System/Library/LaunchDaemons/, it can be launched after reboot. But it's not a good solution for me. If i use "launchctl load /Library/LaunchDaemons/com.MyApp.tmsm.launcher", it works well. If i install other commercial software which is a daemon and have a plist under /Library/LaunchDaemons/, it can't be launched, too.

It seems any plist under /Library/LaunchDaemons/ isn't loaded by system. I also try to turn on launchctl debug level with the command, "launchctl log level debug", but there is no more messages after reboot. Is the debug level reset after reboot? Is other logs or configs i can check??

Thanks.

有帮助吗?

解决方案 2

I found the root cause...It's quite stupid... The permission of my plist under /Library/LaunchDaemons/ is correct. However, the permission of /Library/LaunchDaemons/ is modified to 755. That's why any daemons registered under /Library/LaunchDaemons/ can't be loaded automatically...

其他提示

Try to load it with -w parameter: sudo launchctl load -w /Library/LaunchDaemons/blablabla.plist. Looks like problem in Disabled key. see man launchctl for details.

If that will not work I suggest you to enable some logging to file in your daemon to see if it starts (may be it just exits immediately?)

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top