How to edit the hosts file in Mac OS X
The hosts file is a plain text computer file used in an operating system to map hostnames to IP addresses.
- Open Terminal by typing “Terminal” on the Spotlight.
- Open the hosts file by typing (on the Terminal):
sudo nano /private/etc/hosts
When prompted, type your password.
- Edit the hosts file by navigating using the arrow keys. You can either append new mappings under the default ones or edit the default values (i.e. 127.0.0.1 localhost).
- Save the hosts file, when done, by:
- Flush the DNS cache by typing (on the Terminal):