Mac OS X Lion hosts file slow names resolution

Posted: July 15, 2012 in Mac OS X
Tags: , , , , ,

Mac OS X Lion introduced some bug which I personally can’t understand. It resolves hosts via external DNS servers and then tries local hosts file. At least it looks so. This is annoying and makes no sense. I’ve been struggling this issue for a long time and finally I found a solution, thanks to Jeremy Dunn from Stack Overflow.
He pointed out to Lion’s bug in hosts file resolution. What you have to do is just write your local domains in the first line where 127.0.0.1 is specified.
So your hosts file will look like this

127.0.0.1 localhost myproject.dev myotherproject.dev
::1 localhost
fe80::1%lo0 localhost

This *somehow* makes Mac use it as the first option and the lag in resolution just goes away!
Here is the link to Jeremy’s answer: http://stackoverflow.com/a/10200111/853389

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s