Your computer uses the HOSTS file to look up/resolve domain names to an IP address. This file can force your computer to resolve your website to a specific IP address rather than using the DNS entries indicated by the domain’s name servers.
Manually configuring your domain with the IP address of your InMotion Hosting server will allow you to point a domain name to a different server location using an IP address. A HOSTS file change is intended to be temporary and should not be used with the published website.
Video – How to Edit Your HOSTS File on a Mac
Edit HOSTS File in a Terminal Client
You can use a terminal client application, or the one Apple provides in its operating system when editing your HOSTS file.
- Open the Terminal client of your choice.
- Edit the HOSTS file in the terminal window using one of the commands below.
sudo nano /private/etc/hosts
For newer versions of Mac OS, use this command:
sudo nano /etc/hosts
- Enter your Apple login password for your device.
- Edit the HOSTS file by adding these two lines.
SERVER_IP_ADDRESS domain.com
SERVER_IP_ADDRESS www.domain.com
This is an example of how it would appear in the HOSTS file:
86.75.30.9 domain.com
86.75.30.9 www.domain.com
NOTE: Replace “domain.com” with your actual domain name. If you are unsure which IP address to use, please contact our Support Department for further assistance.
- Save your changes by pressing Control-O on your keyboard, then hit the enter key to accept the filename.
- Exit the editor by pressing Control-X.
How to Flush the DNS Cache
You may need to flush your Mac’s DNS cache for the HOSTS file change to work. Use the following command to flush the cache:
- Open your Terminal client.
- Type in the following command:
dscacheutil -flushcache
- Hit enter to run the command.
This completes the HOSTS file modification. You can now see your website using a domain name pointing to the specific IP address you added to the HOSTS file. If you no longer need the changes in the HOSTS file you can repeat the steps above and remove the changes you added.
If you are using Windows, please refer to our guide on how to Modify Your Hosts File Using Windows.
Learn more about DNS management with our DNS and Nameserver Changes Education Channel.