Easily modify hosts file on Mac

Posted in: Web Design, Work on November 23rd, 2013

I was writing this in an email to a client who is also a Mac user, and thought others might find it useful!

What we are effectively doing is telling your computer (via the hosts file) to direct a URL (eg, website.com) to a specific IP address, instead of the default one provided by the DNS server. This allows you to setup a complete website design privately on a new host, and then flick the DNS over when you are ready to make the new site live.

As a newish Mac user, I found it more complicated modify hosts on my Mac than it was when I was a windows user – at first I was typing into the Terminal. But then I found a great little GUI app, Hosts, by Permanent Markers.

How to modify hosts file

Hosts app icon
Download and install this awesome GUI hosts editor app

Open Mac system preferences. You should see a new option which is an orange square with H in it (like the one on the right).

Click the lock to enable editing – you’ll probably need to enter your password.

What the hosts file GUI looks like
What the hosts file GUI looks like

Click the + icon at the bottom to add a new entry.

In the ip column, enter the IP address you want to direct to, eg, 164.257.135.339

In the hostname column, enter the URL you want to direct to the IP you just entered,. eg somewebsite.com

Hit enter  to save the new entry.

Now you have directed a URL to a specific IP with your hosts file!

To direct to the new site, make sure the box is checked next to your new entry. To stop the redirection and view the current site, uncheck the box.

Share This:

Leave a Reply