hosts file in MAC X

by GJSenthil 2013-06-27 15:35:32

Let us know where is the hosts file in MAC X and how to edit it.

The hosts file in MAC is located in /private/etc/hosts

1. Open the terminal

2. If you can use the vim, do give the command as vim /private/etc/hosts

3. you can see the below

mac_hosts.jpg

It has one entry per line, with the hostname followed by the IP address.

4. Add your entries to the end of the file.

5. Save the file by pressing Control + O keys and press Enter.

6. To get the changes reflected, the DNS cache needs to be flushed.

OS X 10.5 or later use this command:

dscacheutil -flushcache

OS X 10.4 or earlier use: kindly use

lookupd -flushcach

Now you have edited the hosts file and the changes will reflect in the browser by refreshing it.

Tagged in:

509
like
0
dislike
0
mail
flag

You must LOGIN to add comments