Like many Unix-based and Unix-like operating systems, it is possible to change the hosts file on your Mac to manually point a domain to a certain server.

Changing this file will override any DNS settings you might receive from your ISP, so this is a good way to test a site before you have transferred the domain from your old host to us.

Modifying the hosts file in Mac OS X 10.2 and later is a pretty easy task, but it must be done as the “root” user in the terminal. This change will point ONLY your Mac to your site with us. It will not affect other computers' access to your site at your former host.

Please note, these instructions are applicable to users running a Mac system. If you are using Windows, please see our article How to modify your hosts file in Windows.

Below are the five easy steps you'll need to take.

spotlight_terminal1) Open the Mac's Terminal.

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

sudo_nano_hosts2) 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.

3) Edit the hosts file by adding these two lines to the bottom of the file.

SERVER_IP_ADDRESS domain.com
SERVER_IP_ADDRESS www.domain.com

For example, it should look like:

67.199.146.25 domain.com
67.199.146.25 www.domain.com

Be sure to place domain.com with your actual domain name and the IP address with the shared IP of the server your account is on. The server's shared IP can be found in the Stats column on the left side of the cPanel home page.

4) Save 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.

5) You may need to flush your Mac's DNS cache, so copy/paste the below command string into terminal, and press return.

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.

Did you find this article helpful?

We value your feedback!

Why was this article not helpful? (Check all that apply)
The article is too difficult or too technical to follow.
There is a step or detail missing from the instructions.
The information is incorrect or out-of-date.
It does not resolve the question/problem I have.
How did you find this article?
Please tell us how we can improve this article:
Email Address
Name

new! - Enter your name and email address above and we will post your feedback in the comments on this page!

Did you find this article helpful?

Comments

2013-04-03 3:41 am
Is it necessary to change these files back after the nameservers are switched?
Staff
17,314 Points
2013-04-03 4:28 am
Hello PerfectChurch,

The hosts file change is typically used to FORCE your computer to look at a different location. If the domain has already changed its name servers to the correct host, then you can remove the HOST settings.

For more information on Name Server changes, check out:"

http://www.webhostinghub.com/help/learn/domain-names/registrations-and-transfers/transfer-versus-nameserver-change

If you have any further questions, please contact technical support or leave a comment at the bottom of the page.

Regards,

Arnel C.
Community Support

Post a Comment

Name:
Email Address:
Phone Number:
Comment:
Submit

Please note: Your name and comment will be displayed, but we will not show your email address.

Related Questions

Here are a few questions related to this article that our customers have asked:
Ooops! It looks like there are no questions about this page.
Would you like to ask a question about this page? If so, click the button below!
Need More Help?

Help Center Search

Current Customers

Email: support@WebHostingHub.com Ticket: Submit a Support Ticket
Call: 757-416-6627 Chat: Click To Chat Now

Ask the Community

Get help with your questions from our community of like-minded hosting users and Web Hosting Hub Staff.

Not a Customer?

Get web hosting from a company that is here to help.
}