MacOS – Issue turning firewall off on OS X El Capitan 10.11.2

firewallmacosNetwork

I'm trying to make a simple web server on my machine accessible to a peer on the same network, but with not much success. I am having an issue where my firewall continually turns back on, or won't turn off (I can't be sure which).

I go into System Preferences -> Security & Privacy -> Firewall, unlock settings, and click 'Turn off Firewall'. It appears to work. I click the lock in the bottom left to save my settings, and then exit System Preferences. But a port scan shows none of my ports are accessible to inbound connections, still. Then I go back into firewall settings, and it shows my firewall as being on again, even though I just turned it off.


What I have tried so far:

  • I have searched for others having this problem, but I cannot find anything.
  • I also restarted my machine, but the issue persists.
  • Per some google results, I executed sudo defaults write /Library/Preferences/com.apple.alf globalstate -int 0 in terminal, but defaults read /Library/Preferences/com.apple.alf globalstate still returns 1 (on).

How can I turn my firewall off?

EDIT: I think this may be related to the fact that these firewall settings were set on my previous Macbook Pro, and I have since upgraded to a newer macbook using Time Machine.

Best Answer

I'm going to put a short answer on how I'd troubleshoot this since this isn't the intended behavior.

  1. Make a backup of your Mac - just in case.
  2. Try a simple python web server in terminal.app

    python -m SimpleHTTPServer

You should see text like: Serving HTTP on 0.0.0.0 port 8000 ... and get a pop up like:

enter image description here

If you don't, perhaps delete the entire firewall preference and restart the Mac once the backup is complete.

sudo -H mv /Library/Preferences/com.apple.alf.plist ~/Desktop

That way you can inspect/move the preference file back if desired. If you still cannot get the firewall pop up after the restart, recheck the firewall system preferences and optionally see if you might have a configuration profile that might be enforcing some firewall settings that you do not control.

enter image description here

If you have no profiles icon, you can probably rule that out.