How to edit the hosts file

appleThe hosts file is a local file on your Mac, that allows you to override DNS records. This can be useful if you need to access a website for which you are waiting for DNS changes to be replicated across the internet.


Terminal

We will start by opening Terminal.

  1. Go to Applications > Utilities > Terminal.
  2. Run the following command:
sudo vi /private/etc/hosts

Add the following lines to the bottom of this file, and Save the file.

123.45.67.89 mywebsite.com
123.45.67.89 www.mywebsite.com

 

Thanks for visiting.