Change Firewall settings on Mac
On your Mac, use Firewall settings 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 settings, choose Apple menu > System Settings, click Network in the sidebar, then click Firewall on the right. (You may need to scroll down.)
Prevent unwanted connections from the internet or other networks.
Choose how much to block incoming connections.
Block all incoming connections
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.
Add an app or service to allow incoming connections.
Remove an app or service from allowing incoming connections.
Certain shared services can connect through the firewall when they are turned on in Sharing settings. For additional security, you can prevent connections to these incoming services by turning off the service in Sharing settings. See Change Sharing settings.
Automatically allow built-in software to receive incoming connections
Automatically allow downloaded signed software to receive incoming connections
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
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.