Skip to content

Instantly share code, notes, and snippets.

@dominikkaegi
Last active October 12, 2020 07:44
Show Gist options
  • Save dominikkaegi/027fbdb573310f082ea8e3ac3c1dd5d6 to your computer and use it in GitHub Desktop.
Save dominikkaegi/027fbdb573310f082ea8e3ac3c1dd5d6 to your computer and use it in GitHub Desktop.
This is an instruction on how to block websites on your computer

1. Edit the /etc/hosts

First open the hosts file:

sudo vim /etc/hosts

Then add the websites you want to be blocked. Make sure to keep the spacing between the ip and the website you want to be bocked. For it to work also with safari we need to add not noly the ipv4 address but also the ipv6 address.

127.0.0.1       twitter.com
::1/128         twitter.com
127.0.0.1       facebook.com
::1/128         facebook.com

2. Flush the cache

sudo dscacheutil -flushcache

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment