How to fix hosts file on Mac

Fixing hosts file on Mac will help to intervene in the system, help block websites or block browser ads.

File hosts on the system help users to intervene deeply into the computer, support users to change the system such as blocking ads from certain websites or software such as blocking ads on Viber, or blocking websites. browser, even support access to blocked websites, .

File hosts on all operating systems allow users to change, edit, add commands to meet the purpose we want to perform. To edit the hosts file on Mac, users also need to follow each step in the order as when editing the hosts file on Windows 10 or changing the hosts file on Linux. The following article will guide readers to change the hosts file on a Mac.

  1. 5 ways to block websites and limit usage time on Linux computers
  2. How to open the hosts file on Windows
  3. How to reset HOSTS files on Windows 7/8 / 8.1 and Windows 10
  4. How to create a new host file on Windows

Instructions to edit the hosts file for Mac

Method 1: Edit the hosts file on Mac via etc

Step 1:

First we press the key combination Command + Shift + G to display the directory access dialog. Next we enter / etc into the search field and click Go to continue.

How to fix hosts file on Mac Picture 1How to fix hosts file on Mac Picture 1

Step 2:

Show etc folder with many files inside. Users browse to fie hosts and then double click to open and edit and save.

In case the hosts file does not save, we overwrite the content, the user moved that hosts file to the desktop or another directory to edit. Then copy to the etc directory to overwrite the existing hosts file.

How to fix hosts file on Mac Picture 2How to fix hosts file on Mac Picture 2

Method 2: Edit the hosts file on the Mac via Terminal

For Mac OS, we have more ways to fix hosts file via Terminal.

Step 1:

Users access to Utilities folder and then click on Terminal in the list to launch. Or we press the keyboard shortcut Commnd + Space and then type the keyword Terminal to open up.

How to fix hosts file on Mac Picture 3How to fix hosts file on Mac Picture 3

Step 2:

In the interface shown, enter the command sudo nano / private / etc / hosts and then type the password of the Mac into the Password line below. Click Return to open the hosts file.

How to fix hosts file on Mac Picture 4How to fix hosts file on Mac Picture 4

Step 3:

Display the hosts file interface for users to edit. We use the left and right up and down arrows to move the cursor to where the content of the hosts file needs to be edited.

How to fix hosts file on Mac Picture 5How to fix hosts file on Mac Picture 5

Step 3:

Once finished editing, we press Ctrl + X and then press Y to agree to save new content to the hosts file. Finally press Return to agree or press N to not save the content.

How to fix hosts file on Mac Picture 6How to fix hosts file on Mac Picture 6

So we have 2 different ways to edit the hosts file, change the content of the hosts file on the Mac. If you edit the hosts file via etc, it is best to copy the file to another location for editing and then copy the etc folder again to overwrite the existing file.

I wish you successful implementation!

3.8 ★ | 10 Vote