Raymii.org
Quis custodiet ipsos custodes?Home | About | All pages | Cluster Status | RSS Feed
OS X: Turn firewall on or off from the command line
Published: 10-05-2013 | Author: Remy van Elst | Text only version of this article
❗ This post is over eleven years old. It may no longer be up to date. Opinions may have changed.
This command lets you turn the build in OS X firewall on and off, on both for specific services or essential services. It works with OS X 10.5, 10.6, 10.7 and 10.8. It also works via Apple Remote Desktop.
Recently I removed all Google Ads from this site due to their invasive tracking, as well as Google Analytics. Please, if you found this content useful, consider a small donation using any of the options below:
I'm developing an open source monitoring app called Leaf Node Monitoring, for windows, linux & android. Go check it out!
Consider sponsoring me on Github. It means the world to me if you show your appreciation and you'll help pay the server costs.
You can also sponsor me by getting a Digital Ocean VPS. With this referral link you'll get $200 credit for 60 days. Spend $25 after your credit expires and I'll get $25!
To turn the firewall off :
sudo defaults write /Library/Preferences/com.apple.alf globalstate -int 0
To turn the firewall on for specific applications/services :
sudo defaults write /Library/Preferences/com.apple.alf globalstate -int 1
To turn the firewall on for essential services like DHCP and ipsec, block all the rest :
sudo defaults write /Library/Preferences/com.apple.alf globalstate -int 2
Tags: apple
, apple-remote-desktop
, ard
, firewall
, mac
, os-x
, snippets