How to Edit Your Hosts File on Mac

Follow the below instructions to update your hosts file on Mac.

1. Open Terminal

2. Type in the following command to open your host file in Terminal:

sudo nano /etc/hosts

You’ll then be asked for your user password, enter it.

Terminal will open the nano editor and it should look something like this:

3. To add a new entry, add the IP address followed by the domain. Or make other edits to the file as needed.

21.215.0.0 mydomainname.com

4. Hit CTRL + X to exit the editor and hit ENTER to save when prompted.