MacOS – start ntpd with launchdaemon

launchdmacos

I would like to start an ntpd on my MacOSX 10.8. ntpd is configured correctly and runs when started manually.
I would like to start it on boot time with lauchdaemon.

I created this com.stefan.ntp.plist file in /Library/LaunchDaemons:

<?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>com.stefan.ntpd</string>
        <key>Program</key>
        <string>/usr/sbin/ntpd</string>
        <key>ProgramArguments</key>
        <array>
            <string></string>
        </array>
    </dict>
</plist>

Added it to the Launchdaemon with

launchctl load /Library/LaunchDaemons/com.stefan.ntpd.plist

However, it does not start.

sh-3.2# launchctl list | grep ntpd
-   0   com.stefan.ntpd
sh-3.2# launchctl start com.stefan.ntpd
sh-3.2# launchctl list | grep ntpd
-   0   com.stefan.ntpd

Any ideas?

Best Answer

There should be an ntpd process started by /System/Library/LaunchDaemons/org.ntp.ntpd.plist by default in 10.8.

The plist is also missing <key>RunAtLoad</key><true/>, but I couldn't get this to work either:

<?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>com.stefan.ntpd</string>
  <key>Program</key>
  <string>/usr/sbin/ntpd</string>
  <key>RunAtLoad</key>
  <true/>
</dict>
</plist>