2

I have a plist in /Library/LaunchDaemons/ that should run as root on startup.

When I run sudo launchctl load /Library/LaunchDaemons/com.apple.pfctl.plist, it works. However on reboot it does not work.

Interestingly, after reboot, when I run that command it says /Library/LaunchDaemons/com.apple.pfctl.plist: service already loaded but it is not functioning. However, if I unload and load it works normally.

Nothing appears in my error reporting /tmp/pfctl.err.

My plist is here:

<?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.apple.pfctl</string>
<key>ProgramArguments</key>
        <array>
                <string>pfctl</string>
                <string>-e</string>
                <string>-f</string>
                <string>/etc/pf.conf</string>
        </array>
        <key>RunAtLoad</key>
        <true/>
<key>StandardErrorPath</key>
<string>/tmp/pfctl.err</string>
<key>StandardOutPath</key>
<string>/tmp/pfctl.out</string>
</dict>
</plist>
  • Can you post the boot messages specific to pfctl by issuing the command dmesg | grep -i pfctl We need to see what errors are being generated, if any. – Allan Oct 29 '16 at 12:05
  • Try changing <string>pfctl</string> to <string>/sbin/pfctl</string> or add <key>Program</key> and <string>/sbin/pfctl</string> before ProgramArguements. – fd0 Oct 29 '16 at 12:19
  • for the record dmesg | grep -i pfctl didn't show any output – jakethedog Oct 29 '16 at 13:13
1

The problem was that there is a default plist for pfctl at /System/Library/LaunchDaemons/com.apple.pfctl.plist. They were conflict.

In that plist I set <key>Disabled</key> to <true/>, and everything works as expected.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .