Testing your site using a hosts file edit on Mac OS

To edit your hosts file on your Mac computer.

Open the Mac's Terminal.
You may either type Terminal on the Spotlight, or by going into Applications -> Utilities -> Terminal.

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

You'll be prompted to enter your Mac user's password. NOTE: you won't see the cursor move. This is normal, so press return when done.

Edit the hosts file by adding these two lines to the bottom of the file.
SERVER_IP_ADDRESS www.domain.com

For example, it should look like: hostinguk.net www.hostinguk.net

The space between the IP address and domain is important. Each domain to test should be a on a new line

Be sure to place domain.com with your actual domain name. If you're not sure what you're IP address to use is, this can be found in your hosting control panel, or by contacting our support team

Save the 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.
You may need to flush your Mac's DNS cache, so copy/paste the below command string into terminal, and press return.

dscacheutil -flushcache

You 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 remember to remove the lines by repeating the steps above, of course removing rather than adding the lines.

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

Testing the site with a Host File edit (windows)

A Host file will allow your local machine to browse the sites as if they were already repointed....