fbpx

How to Edit your Hosts File on a Mac

NOTE: The following guide is intended to assist if you are using a Mac OS X computer. If you are using Windows, please refer to our guide on how to Modify Your Hosts File Using Windows.

The hosts file is used by your computer to lookup/resolve domain names to an IP address. This file can be used to force your computer to resolve your website to a specific IP address rather than resolving your website using the DNS found in the name servers the domain is pointed to. Manually configuring your domain with the IP address of your InMotion Hosting server, will allow you to test your website without affecting the server where your domain is pointed to via the name servers/DNS.

  1. Open the Terminal application. You may either type Terminal in the Spotlight search or by navigating to Applications , then the Utilities folder, then click on the Terminalapp.
  2. Open the hosts file for editing. In the terminal window you just opened copy/paste the command string below, and press return.
    sudo nano /private/etc/hosts or sudo nano /etc/hosts on newer MacOS.
  3. Enter your password when it prompts you to enter your Mac user’s password.NOTE: you will not see the cursor move. This is normal, simply enter your password and press the Return when done.
  4. Edit the hosts file by adding these two lines to the bottom of the file.167.114.107.208 domain.com
    167.114.107.208 www.domain.comFor example, it should look like:86.75.30.9 domain.com
    86.75.30.9 www.domain.comNOTE: Be sure to replace domain.com with your actual domain name. If you are not sure which IP address to use, please contact our Support Department for further assistance.WARNING: Be sure that there is a space between the IP and the URL. Otherwise, the rule will not work.
  5. Save your changes by pressing control-o on your keyboard then return to accept the filename. Exit the editor by pressing control-x. This takes you back to the terminal screen.
  6. You may need to flush your Mac’s DNS cache, so copy/paste the below command string into terminal, and press return:dscacheutil -flushcacheYou may have to add sudo to this command, for example:sudo dscacheutil -flushcache

    This completes the hosts file modification, so you should now be able to see your site here with us using your domain in your browser’s address bar. When testing is complete you may undo these changes by repeating the steps above but removing the information entered in step 3.

Powered by BetterDocs

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to Top