Why won’t launchctl automatically load the plist entries

launchdpliststartup

I have put several plist entries in /Library/LaunchDaemons all configured to run at load. However, after booting, none of them load up automatically. Every other script in this directory loads automatically. My only workaround is to use an app called LaunchControl to manually load them, which works fine. Here is the text of one of these scripts

 <?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>Disabled</key>
        <false/>
        <key>GroupName</key>
        <string>wheel</string>
        <key>InitGroups</key>
        <true/>
        <key>Label</key>
        <string>com.usseinstein.dns</string>
        <key>ProgramArguments</key>
        <array>
                <string>/usr/local/sbin/dnsmasq</string>
                <string>--keep-in-foreground</string>
        </array>
        <key>RunAtLoad</key>
        <true/>
        <key>StandardErrorPath</key>
        <string>/tmp/com.local.dns.stderr</string>
        <key>StandardOutPath</key>
        <string>/tmp/com.local.dns.stdout</string>
        <key>UserName</key>
        <string>root</string>
</dict>
</plist>

Best Answer

Make sure that your plist in /Library/LaunchDaemons/ has appropriate permissions, which is root:wheel otherwise the system will not process them. To set them use following Terminal command:

sudo chown root:wheel /Library/LaunchDaemons/com.apple.something.plist