Change Firewall preferences on Mac
Use the Firewall pane of Security & Privacy preferences to turn on the firewall in macOS to prevent unwanted connections from the internet or other networks. Learn how to block connections to your Mac with a firewall.
To change these preferences on your Mac, choose Apple menu > System Preferences, click Security & Privacy, then click Firewall.
Note: If the lock at the bottom left of the pane is locked , click it to unlock the preference pane.
Turn On Firewall
If the firewall is turned off, click Turn On Firewall to turn on firewall protection.
Click the Firewall Options button to change firewall settings.
Block all incoming connections
In Firewall Options, select to prevent incoming connections to nonessential services and apps.
Basic internet services are a set of apps that allow your Mac to find services provided by other computers on the network. This setting prevents connections to all other sharing services.
In Firewall Options, to add an app or service, click the Add button , select the item in the list, then click Add.
In Firewall Options, to remove an app, select it in the list, then click the Remove button .
Automatically allow built-in software to receive incoming connections
Automatically allow downloaded signed software to receive incoming connections
In Firewall Options, select to allow downloaded apps and services that are signed by a valid certificate authority to be automatically added to the list of allowed apps, without your authorization.
Enable stealth mode
In Firewall Options, select to prevent your Mac from responding to probing requests that can be used to reveal its existence. The Mac still answers requests from authorized apps, but unauthorized requests such as ICMP (ping) get no response.
Click to increase the security on your Mac by adjusting settings in the Change Advanced preferences.
Certain shared services can connect through the firewall when they are turned on in Sharing preferences. For additional security, you can prevent connections to these incoming services by turning off the service in Sharing preferences. See Share your Mac screen, files, and services with other users on your network.