Useful Hacks, Reviews, Tips and Tricks of anything under the moon and the sun.

Modify Hosts File in Mac OS X - Mountain Lion

No comments
I'm liking my new Mac and I think switching from PC to Mac is a good decision. I also started to setup my development environment on Mac and as I do, I learn lot of new things everyday. One new thing I learned is how to edit Hosts File in Mac to map hostnames to IP addresses. To edit the hosts file, just follow these steps.

1. Open the Terminal app, either by using Sportlight or by going to your Applications > Utilities > Terminal.




2. Type the following command

sudo nano /private/etc/hosts

Enter your password when asked.

3. Now edit the hosts file. You edit existing line or add new line.

4. Press control+o to save the file and contro+x to exit the editor.

5. Flush the DNS to apply the changes.

dscacheutil -flushcache

6. Test it by accessing the hostname in your browser.

Thats it!
To stay up-to-date on Technology news, subscribe now.

No comments :

Post a Comment