Firewall security in macOS
macOS includes a built-in firewall to protect the Mac from network access and denial-of-service attacks. It can be configured by going to System Settings > Privacy & Security (macOS 13 or later), the Security & Privacy pane of System Preferences (macOS 12 or earlier), or by using a configuration profile with the Firewall payload installed manually or provided by an MDM solution. The following configurations are supported:
Block all incoming connections, regardless of app.
Automatically allow built-in software to receive incoming connections.
Automatically allow downloaded and signed software to receive incoming connections.
Add or deny access based on user-specified apps.
Prevent the Mac from responding to ICMP (Internet Control Message Protocol) probing and portscan requests.