Mac users with custom entries in their
/etc/hosts files may have noticed that, under Mountain Lion at least, lookup times for local resources are incredibly slow. I routinely set up names that point to virtual hosts on my laptop so I can give projects their own local domain instead of having
http://localhost/projects/something/index.php or somesuch. Typing
something.dev is much easier. I noticed that, since upgrading from Snow Leopard to Mountain Lion, Firefox would spend several seconds trying to look up those names before consulting the hosts file and loading the page.
While I don’t know why it’s happening, exactly, I do have a fix. The wait goes away if you put the local entries on one line.
Instead of having something like this:
#virtual hosts 127.0.0.1 myproject.dev 127.0.0.1 wordpress.dev 127.0.0.1 somesuch.dev
You need to have this:
#virtual hosts 127.0.0.1 myproject.dev wordpress.dev somesuch.dev
Leave the lines that say “localhost” alone, of course. Messing with those could cause all manner of Bad Things.