It is possible to edit the host file using TextEdit so that the host file is shown as a simple plain document. You can find the Host File following these steps:
1. Open the finder and in the finder’s menu bar, select Go, the Go to folder
2. In the Go to folder box, enter this location: /private/etc/hosts and click Go
3. You will see the Finder window open there and you can select the Mac’s host file
4. Now you need to open the host file, you can do this by clicking twice on it. The file will open in the TextEdit. You will see that it has Default IP values for local host and broadcast host.
5. In order to edit it, it is possible to add your own lines of code for broad cast. The host file is edited to block the access to specific websites. It is possible to type the IP address of the website that you want to block.
6. Once you have completed the changes to the host, you will be able to save the current location to the desktop.
7. Drag and drop the host file to its original location (/private/etc/hosts)
8. Repeat the same step Go and then Go to folder and drop the edited file to its original.
How to edit Host file on Yosemite & Maverics
In order to edit Host file on Yosemite and Mavericks, you can do the below:
1. Open the terminal in Applications/Utilities or try to open the terminal via spotlight
2. Back up the hosts file in the document folder, typing this command: sudo cp /private/etc/hosts ~/Documents/hosts-backup
3. In order to open the host file, enter the below command in the command prompt:
sudo nano /private/etc/hosts
4. You will need to enter the administrator password. You can type the password, but won’t be able to see the password in the command prompt.
5. Once the host file is loaded, you can use the arrow keys to go to the bottom of the file to make the notification.
6. Once you have completed the above step, press CTRL+O using ENTER/RETURN to save the changes to /private/etc/hosts and then press CTRL+X to exit.
7. After clearing the DNS cache, verify the host modification