Blocking Outbound Connections to Specific Hosts on Mac

Sometimes it's useful to block outbound connections to a certain host. For example, when testing how your locally-running code reacts when a service it depends on or calls goes down. To block outgoing connections to a given host, say:, edit the hosts file with sudo vi /private/etc/hosts and add a line like this: Then flush the DNS cache so the hosts...
Read More