Use iTunes and the macOS firewall on Mac
If your computer’s firewall settings prevent you from using iTunes features such as music sharing, AirTunes, and Apple TV, you can change the settings to allow you to use these features.
On your Mac, choose Apple menu > System Preferences, click Security & Privacy, then click Firewall.
Click the lock and type your administrator password.
Click Firewall Options.
Do one of the following:
If “Block all incoming connections” is selected, deselect it.
If iTunes is included in the list of applications, choose “Allow incoming connections.”