How to block websites on Mac

In terminal.app do:

sudo nano /etc/hosts

Add 127.0.0.1 www.example.com at the end of the file, replacing the domain mane with a domain name you wish to block. For example:

127.0.0.1       facebook.com
127.0.0.1       www.facebook.com
127.0.0.1       twitter.com
127.0.0.1       www.twitter.com
127.0.0.1       instagram.com
127.0.0.1       www.instagram.com

Save with control+o and exit with control+x

Last step it to flush your cache.

sudo dscacheutil -flushcache

I'm an industrial, product and experience designer from Helsinki, Finland. I live in a log house about an hour from Helsinki. I drink excessive amount of tea, and own enough books to last me lifetime. This website is my little dusty corner of the internet.