Changing the Hosts File on a Mac OS X Lion 10.7 and later

Sometimes you want to move a website to a new server and test it before pointing the record to the new server and the new site. The following steps will tell you computers browsers to look at the new server while the rest of the world will still view the old one. Yay!

Open Terminal:

sudo nano /etc/hosts

enter you password and hit enter. (you won’t see the password being typed)

use the arrow keys to go down to the next available line and enter your ip and url you want to view.

## WP Munchies Site
xxx.xx.xx.xxx www.wpmunchies.com
xxx.xx.xx.xxx wpmunchies.com
xxx.xx.xx.xxx http://www.wpmunchies.com
xxx.xx.xx.xxx https://wpmunchies.com

(obviously the x’s will be replaced with the ip you will be pointing to.)

Hit Control+O to write out. Hit Enter. A report will write, and you can hit Control+X to exit the nano report.

If your changes don’t take immediate affect, you can do the prompt:

sudo killall -HUP mDNSResponder