Runar Ovesen Hjerpbakk

Science-based software development

Make the macOS firewall to permanently allow iOS apps running in the simulator

macOS has an awesome firewall, however the default setting is very harsh for us iOS developers.

When debugging iOS apps requiring incoming network connections to function in the simulator, this popup appears:

macOS firewall popup

Pressing Allow gets old real fast.

Here is how you can disable the popup for all your iOS apps. In the Terminal, execute the following commands.

#temporarily shut firewall off:
sudo /usr/libexec/ApplicationFirewall/socketfilterfw --setglobalstate off

#put Xcode as an exception:
/usr/libexec/ApplicationFirewall/socketfilterfw --add /Applications/

#put iOS Simulator as an exception:
/usr/libexec/ApplicationFirewall/socketfilterfw --add /Applications/

#re-enable firewall:
sudo /usr/libexec/ApplicationFirewall/socketfilterfw --setglobalstate on

The lines with hashtags (#) are Bash comments and can be omitted, but these are useful if you use the commands i a script.