Last Updated: February 25, 2016
· pasine

Set Block all incoming connection via command line

I don't like to have any open port when I am connected to a public WiFi, so I usually turn on the Block all incoming settings from the Firewall preferences.

Here is a way to set/unset it via command line.


sudo defaults write /Library/Preferences/ globalstate -int 2


sudo defaults write /Library/Preferences/ globalstate -int 1

Bear in mind that the Preferences Panel must be closed to apply this change.

I also created a workflow to set/unset this option via Alfred.