Last active
August 29, 2015 14:13
-
-
Save shichao-an/56fb7bc64b6731130573 to your computer and use it in GitHub Desktop.
Restart firewall on OS X
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Restart firewall on OS X 10.9 and 10.10 | |
# This script only works if you already turned on your firewall | |
if /usr/libexec/ApplicationFirewall/socketfilterfw --getglobalstate | grep 'Firewall is disabled.' > /dev/null | |
then | |
echo 'Firewall is turned off.' >&2 | |
else | |
sudo /usr/libexec/ApplicationFirewall/socketfilterfw --setglobalstate off && sudo /usr/libexec/ApplicationFirewall/socketfilterfw --setglobalstate on | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment