Block domains and IPs on macos
1. Add a rule to the current ipfw table
sudo sudo ipfw add 70000 deny tcp from any to facebook.com
set port to port 80 if ouy just want to block HTTP
See: http://www.freebsd.org/doc/handbook/firewalls-ipfw.html
2.use a DNS service to block many things
http://opendns.com
Hint: Set your DNS servers to use your routers IP address, and then configure which DNS servers to use over there. That means you won't have to reconfigure every single device on your network, but instead they populate via DHCP and you can easily change the DNS relay depending on your needs.
Tutorial for macos yosemite: https://support.opendns.com/entries/58244194-OSX-Yosemite
3. Add a rule to etc/hosts
sudo pico /etc/hosts or sudo nano /etc/hosts
add domains:
0.0.0.0 www.example.com
127.0.0.1 www.example1.com
You can use a fake ip or lookup any other ip (nslookup domain.com) and add it
sudo dscacheutil -flushcache