Last Updated: February 25, 2016
·
35.87K
· gavinbunney

Disable Mac OSX Firewall from Command Line

So.. you turned on the firewall on your remote Mac, and now you've locked yourself out of Screen Sharing? Good work. I've... err... never done that before.

You can turn off the firewall by setting the global state to 0:

sudo defaults write /Library/Preferences/com.apple.alf globalstate -int 0

Then just restart the firewall agent services:

sudo launchctl unload /System/Library/LaunchDaemons/com.apple.alf.agent.plist
sudo launchctl load /System/Library/LaunchDaemons/com.apple.alf.agent.plist

And presto! You're back into your Mac!

2 Responses
Add your response

Awesome, thank you so much!! For some reason this was the only post I could find with a clear explanation.

over 1 year ago ·

Thanks. I'll test this out.

over 1 year ago ·