MacOS – How to block an app’s access to a specific website using the hosts file

hostsinternetmacosNetwork

I want to block an app from connecting to a specific website using the hosts file. How can I do that?

Is something like this possible:

127.0.0.1     foo.com:spotify

Best Answer

The hosts file is used by the system and can't be used to restrict access for specific apps.

See I'm trying to block game "X" from accessing the internet including updating for alternative software which is able to block specific apps from accessing specific sites.