Block A Website On Mac

Block A Website On Mac
Block A Website On Mac

You can block a website on Mac, editing Hosts file is also a way to block unwanted sites on a Mac.Follow the simple steps below

Open Applications/Utilities/Terminal and type the following (it will ask you to enter admin password because it is a system file):

  • sudo nano /etc/hosts

You will get a Nano box. Type in the website you want to block in the following format:


If you want to add more websites, type in the same format.

  • One line, one site.

Click CTRL+X and Press Y in your keyboard to save modified buffer, and then press Enter to go back to Terminal.

Run the following command in Terminal to take the changes take into effect:

  • If you are using Tiger, type the following and press Enter: lookupd flushcache
  • For Leopard and later, type the following and press Enter: sudo dscacheutil flushcache


  • Don't edit the default hosts file lines because they are important for your computer running.
  • Don't forget to add www if the URL you want to block has been prefixed with www, or it will not work with Safari.
  • This way is only for those who know Admin Password. If you know nothing about Admin password, this way will not work for you.
  • By modifying the Hosts file we can block any sites we want to on Mac. We do not suggest this way if you are not Mac savvy enough. To block websites, you can use a third-party Parental Control Tools. There are tools good at parental blocking.

Help Us Grow

If you like this post, please share it with your friends.

You are free to copy and redistribute this article in any medium or format, as long as you keep the links in the article or provide a link back to this page.

Subscribe to our mailing list

You may also like...