Skip to content

Instantly share code, notes, and snippets.

@thelatestcheckout
Last active March 2, 2024 11:10
Show Gist options
  • Save thelatestcheckout/860264140f5cdf0a4f4f3c43e7719414 to your computer and use it in GitHub Desktop.
Save thelatestcheckout/860264140f5cdf0a4f4f3c43e7719414 to your computer and use it in GitHub Desktop.
Block and Unblock a website on MAC
Block a website ( www.facebook.com )
1. Open terminal
2. Enter following command -
sudo nano /etc/hosts
3. Enter MAC system password
4. Scroll down and make an entry for the website you wish to block -
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
127.0.0.1 www.facebook.com
127.0.0.1 facebook.com
127.0.0.1 www.fb.com
127.0.0.1 fb.com
5. Press Control(^) and X to Exit
6. Press Y fo yes to save the entry
7. Press Enter to come out of the file
To Verify -
1. Clear Cache using the following command -
sudo dscacheutil -flushcache
2. Open Chrome (works for chrome) - Check the website (www.facebook.com)
( or )
1. Restart your computer
2. Open Chrome (works for chrome) - Check the website (www.facebook.com)
Done.
=============
UnBlock a website ( www.facebook.com )
1. Remove/Replace the site address from /etc/hosts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment