The hosts file is a location in your operating system that allows you to manually define where your computer should look for specific domain names. This bypasses DNS and ensures you are directed to a specific server.
Manual entries in the hosts file are often used as temporary solutions, most often for testing websites before DNS propagation or troubleshooting communication in Active Directory configurations.
These instructions are for Mac OS, click the following link for instructions on Editing the “hosts” File on Windows.
Only administrator users have access to update the hosts file, please ensure you have administrative access before continuing.
Changes to the hosts file are often blocked by antivirus software, temporarily disable any antivirus software you have running to avoid issues.
Open “Terminal” by searching for it from Spotlight. You can reach Spotlight by clicking on the magnifying glass icon in the top right of the screen or pressing “Command + Spacebar”
In Terminal type “sudo nano /private/etc/hosts” and press enter. You will be prompted for your password in the Terminal window, type it and press enter. When entering your password the keys you press will now show up in the Terminal window, this is expected behavior.
Navigate to the bottom of the file using the arrow keys. You can then type or paste in the desired entry into the hosts file. When you have made your changes press “Control + O” to save then “Control + X” to exit.
You can verify the entry is in effect by running a ping request to the IP address by typing “ping example.com” replacing example.com with the address you added to the hosts file. Verify the IP address returned by the ping request matches the value you entered in the hosts file.
You can now re-enable your antivirus software if applicable and close the Terminal window.