Lion hosts file bug/ Issue

If you are working with website development or want to block or redirect access to specific domains, you have probably edited the system file /etc/hosts like me. I have recemtly upgraded to Lion and to my astonishment, I found that the entries in the hosts file is anymore considered. After a lot of checking around, this is what worked for me.

1. If you don’t have the program TextWrangler (Free text editor for Mac), go ahead and install it.

2. Launch Terminal (Go to Applications>>Utilities)

3. in the terminal type  sudo edit /private/etc/hosts

4.Enter your password

5. This will launch Textwrangler with the content of the hosts file

6. Ensure that you are having the following format in your hosts file, otherwise you can copy the code shown below and past it there.

# Host Database
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
## localhost    broadcasthost

## localhost ip4 first.localhost second.localhost third.localhost

## localhost ip6
::1 localhost
fe80::1%lo0 localhost

7. Go through each of the line and check whether each line is showing Unix (LF) as shown in the below picture and save it.

8. Go to terminal and type  ping first.localhost , If you are getting a response as shown below, then it is working fine.

Good luck!!

Lion hosts file bug/ Issue

Leave a Reply

Your email address will not be published. Required fields are marked *