PF set condition for not equal to a list of ports for MacOS I'd like to set a condition so that a firewall rule will not apply to a list of ports, something along the lines of this:

 table &lt;my_table&gt; persist file "/etc/pf.anchors/entries"
 set skip on lo
 block out quick proto { tcp, udp } from any to ! &lt;my_table&gt; port != { 66 80 } 


This gives a syntax error when running 'sudo pfctl -vnf /etc/pf.conf'. 

If I put the following, it works (only specify one port).

 block out quick proto { tcp, udp } from any to ! &lt;my_table&gt; port != 80


How can I specify a list of ports with the '!=' operator?
You can make the inverse command logic. 

First Block all, then open just the ones you want: 

The result is the same you tried by negating all except those chosen to be opened. :)

set skip on lo
port_pass = "{ 80 66 53 22 }"
block all
pass out on en0 proto { tcp, udp } to any port $port_pass keep state