If you spend a lot of time on the computer like I do, there’s a good chance that there are some websites that you spend too much time on. Recently I’ve taken measures to outright block various distracting websites on my home computer.
On OS X and Linux you can block websites by adding entries like the following to the
/etc/hosts file. (On Windows, the hosts file lives at
# Block distracting websites 127.0.0.1 news.ycombinator.com 127.0.0.1 arstechnica.com 127.0.0.1 slashdot.org #127.0.0.1 facebook.com #127.0.0.1 www.facebook.com #127.0.0.1 reddit.com #127.0.0.1 www.reddit.com
On OS X, you would also need to running the following terminal command to refresh the hosts file:
After doing both of these, attempting to visit one of the websites listed in
/etc/hosts will display an error page.
Of course if you need to temporarily visit one of the blocked sites you can just go back to the hosts file and add a
# before the corresponding entry.
I still use the above
/etcs/hosts technique (from 2013) to block
distracting websites on my Mac laptop.
On the iPhone I use the built-in Screen Time feature to block myself from distracting websites:
On macOS 10.15 Catalina and later there is a similar built-in “Screen Time”
feature that appears to be usable in the same way as the “Screen Time” feature
on iPhone. However since I’ve elected to limit my Macs to upgrade to a max of
macOS 10.14, I still preferentially use the older
/etc/hosts trick described
earlier in this article.