Edit hosts File in Mac OS X
Mac Hosts file located in /etc (OS X 10.5 Leopard). You can directly browse the host file by Going through Finder menu : Go > Go to Folder… option and enter /etc to browse all files in /etc folder.

By doublecli-cking on the host file will open in TextExit where you can make the changes. But by default Mac won’t allow you to edit this host file. To do this, you need to have Super User rights. You much Enable root login and login as root to edit this file directly in TextExit.
Other way of doing this would be through Terminal.
- Open your Terminal
- Type sudo pico /etc/hosts
This will open the host file in pico editor in your terminal. Make the changes and hit the ctrl + x keys to save. It will ask if you want to save changes. Type “y” to indicate yes. If you see closely it will ask file name in your terminal, just enter and it will overwrite existing hosts with updated list.
Flush your DNS to make changes to effect or restart.
OS X Leopard : dscacheutil -flushcache
Before Mac OS X 10.5.1: lookupd -flushcache
Guide on Pico:
