Changing the host file on a Mac is very easy, but it’s certainly not intuitive. This little tutorial will show you how.
Launch Terminal
Type:
sudo su
vim /etc/hosts
shift-a
Scroll to your desired insertion point and enter the info in this format:
IP address [space] www.example.com [space] example.com
Then the following to save and close the file:
esc
:wq
enter
exit
Done!
This comes in handy when doing development on a new site — point your host file to the dev server and test the site before pushing it live.
Remember to delete the entry when you want to go back to the live site. You can also comment out the entry (if you think you may want to use it in the future) by prepending the entry with a # — example:
# IPaddress www.example.com example.com
Thanks Casey!
March 11, 2010 at 11:30 am |
Just landed on this post via Google lookup. I love it. This post switch my perceptual experience and I am getting the RSS feeds. Cheers.