The hosts file in a computer represents a simple plain text file, where are mapped hostnames to IP addresses (wiki).
To edit this file on Mac OS X is a very simple task:
- Open the Terminal.app
(using Spotlight : command + space – and then write terminal)
- Edit the file /private/etc/hosts
(you can use vim or nano …. ex: sudo nano /private/etc/hosts)
- Add the new map:
add at the end the new map you want : ex: 127.0.0.1 new.address.com
- Save the hosts file
save the file with the new map
If you want that your change to take place immediately, run the following command:
- dscacheutil -flushcache
Now you can test the new mapping.