Home » Blog » Mac OS X » How to Block Unblock Website on Mac Terminal?

How to Block Unblock Website on Mac Terminal?

  author
Jamie Kaler   Contribution
Rollins Duke
Rollins Duke  Approved By
Published On June 18th, 2022 • 3 min read

You will understand how to block or unblock a website on a Mac terminal in this section. You may go one step higher by simply preventing your computer from visiting some websites altogether. The majority of online browsers are equipped with plugins that can assist you in remaining productive and preventing you from opening websites on which you are spending time.

There are a variety of methods available for blocking websites on a Mac, including the built-in function of Parental Control, third-party applications that are specifically designed to block websites and applications, and altering the host’s files on your Mac. However, the use of Terminal is by far the simplest method for blocking websites on a Mac.

One can want to block a website for different reasons. It may be attempting to deliver you malware or unwanted messages. Or if the PC is used by youngsters then you may block some pornographic material or ultra-violent media to guarantee that they are not harmed by it when simply skimming over the internet. While no form of the material may be prevented 100 percent you can always the key websites and attempt to control the use of your PC.

Therefore, in this section, we will demonstrate the most effective method for blocking websites on a Mac by utilizing Terminal.

How to Block Websites on Mac using a Terminal?

To block or unblock a website on the Mac terminal process, admin login details are must important. All the steps are given below:

  1. Open the terminal on your Mac system.
  2. Now enter the command to open the host’s file:
    sudo nano /etc/hosts

    block unblock website on mac

  3. Here you have to enter the login details of the admin account.

    enter the login details

  4. Find the line “127.0.0.1 Localhost” in the editor.

    Find the line

  5. Now type this command:
    127.0.0.1 <TAB> <website url>
    Example: 127.0.0.1  www.facebook.com

    type this command

  6. Now press CTRL + O to save the changes and return from the terminal.

    save the changes

Now open your browser and search the blocked website to recheck whether that site is blocked or not.

Now you can see the whole process to block websites on Mac using the terminal. After that, we will show you how to unblock websites on Mac using the terminal. The complete procedure is mentioned below:

How to Unblock Websites on Mac Terminal?

  1. Firstly, Open the terminal on your Mac system.
  2. Now type the command to open the host file:
    sudo nano /etc/hosts
  3. And the screen will open and enter the admin login details here.
  4. Now find the blocked websites here.
  5. After that, use the # icon in Infront of blocked sites, as you can see below:

    unblock website on mac terminal

  6. Lastly hit the CONTROL + O to save the changes and then open the website on your web browser.

Time to Say Goodbye

Finally, as you may notice from the instructions that were provided above block unblock websites on a Mac terminal is an easy process that takes little time. Above, you get the complete and detailed knowledge to block or unblock the websites.

BitRecover Offer