Removing all firewall rules aggressively

Originally posted on 2022-01-14

In certain situations you may find yourself with a Mac that is configured with firewall rules that are so restrictive that you can’t manage to do any work. Sometimes that firewall is not the native firewall in the operating system so it is hard to disable.

If this is what you’re running into you’ve come to the right place. I present you with a script that is the sledgehammer of making sure firewall rules are not in your way.

Use this script with great care because it leaves you completely open to everything.

#!/usr/bin/env bash

while :
do
	sleep 1
	sudo pfctl -F all
done

Translation: Every second make sure you are root and then flush all rules.