Domain Names, Getting Started

Edit Hosts File on Mac

 

Summary

This article shows you how to edit your .hosts file on Mac OS X.

Modifying your Mac’s .hosts file is a smart way of viewing your domain immediately after a new registration, transfer or DNS change. See How long does it take for my domain name to become active?

How does it work?

When you view a website, your Mac looks at it’s .hosts file to try to map the site host-name to an IP address. If a match is not found, your Mac tries to find an IP address using the Domain Name System (DNS).

Editing your Mac .hosts file let’s you intercept the DNS lookup and redirect a domain name to another IP address.

The computer at the receiving IP address should be setup to answer to your domain name.

Why update my Mac’s .hosts file?

  • Easy migration. You can publish and test your site on your Ecenica Hosting web space without taking your old site offline.
  • Faster web development. You can develop and test your site on your local server using your domain name.
  • Redirect your domain to a local IP address.
  • Simple and easy to use.

How do I change my Mac’s .hosts file?

To view your website before updating your domain’s name servers or DNS records you will need to change your HOSTS file to point to your Ecenica Hosting IP address (Computer).

Tip: Try Gas Mark. A simple, and free hosts file manager for Mac OS X Leopard and Snow Leopard Download Gas Mark

Apple OS X Snow Leopard & Leopard

  1. Open Terminal (Click Spotlight, or press Command+Space. Now type terminal.)
  2. Copy and paste the following code into Terminal
    sudo /Applications/TextEdit.app/Contents/MacOS/TextEdit /etc/hosts

  3. Press Enter.
  4. Insert your Ecenica Hosting web site’s IP and domain name. See example below.
  5. Save by pressing Command+S, click Save.
  6. Restart your browser before attempting to view your site.

Example showing adding 100.100.100.100 example.com to hosts on Snow Leopard.


##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost

##My Ecenica Hosting Websites
100.100.100.100 example.com

Apple OSX 10.4.X Tiger

  1. Open Terminal (Click Spotlight, or press Command+Space. Now type terminal.)
  2. In Terminal type, ‘sudo pico /etc/hosts‘, press Enter.
  3. Insert your Ecenica Hosting web site’s IP and domain name. For example: 100.100.100.100 example.com.
  4. Press Ctrl+X, then Y to save.
  5. Type ’sudo niload -v -m hosts . < /etc/hosts', press Enter
  6. Type ‘lookupd -flushcache’, press Enter.
Tip: To save having to retype sudo pico /etc/hosts, when terminal opens, press the ‘up’ cursor key to scroll through the last actions.

This page is wiki editable click here to edit this page.

Sponsors

Web Hosting – £2.99/mo

Reliable UK web hosting. Free tech support. Trusted UK host since 2004. Free setup. Order online.

http://ecenica.com/

cPanel Hosting – £4.99/mo

Fast cPanel hosting with email. Choice of UK/US servers. 30-day money-back promise. Founded 2004.

http://ecenica.com/

 

Related posts:

 

Tags: , , , , , , , , , , , , ,

Share this article

If you found this article useful, please feel free to re-tweet. The Bit.ly Url for this post: http://bit.ly/bKIyV7.

Leave a Reply

You must be logged in to post a comment.

Still need help?

Please login to account and submit a new support ticket.

Copyright

Unless stated, this article is subject to Ecenica Hosting copyright protection. We've worked really hard to bring you this site so before you click copy & paste please take a moment to read our Copyright Notice.

Back to Top