Tips & Tricks
How to Edit the Hosts File in Mac OS X
November 7, 2014
0
Step 1 Open the Terminal.app

Either by start typing Terminal on the Spotlight, or by going into Applications -> Utilities -> Terminal.

Step 2 Open the hosts file

Open the hosts by typing on the Terminal that you have just opened:

$ sudo nano /private/etc/hosts

Type your user password when prompted.

Step 3 Edit the hosts file

The hosts file contains some comments (lines starting with the # symbol), as well as some default hostname mappings (e.g. 127.0.0.1 localhost). Simply append your new mappings underneath the default ones. Or edit one of the default values if you know what you are doing! You can navigate the file using the arrow keys.

Step 4 Save the hosts file

When done editing the hosts file, press control-o to save the file. Press enter on the filename prompt, and control-x to exit the editor.

Step 5 Flush the DNS cache

On Leopard you can issue a simple Terminal command to flush the DNS cache, and have your host file changes to take immediate effect:

$ dscacheutil -flushcache

You can now test your new mapping on the browser!

About author

ZERIN

CEO & Founder (BdBooking.com - Online Hotel Booking System), CEO & Founder (TaskGum.com - Task Managment Software), CEO & Founder (InnKeyPro.com - Hotel ERP), Software Engineer & Solution Architect

How To Copy SVN Project From One Host to Another Host

Today I need to move the whole SVN to a new serve...

Read more

Running Multiple Instance of Skype

Read more

MAC OSX: Delete Finder preferences using ‘Terminal’ App

Step 1: Open Terminal, located in the Applications...

Read more

There are 0 comments