Slow localhost on OSX Lion

It seems with the Lion operating system update the addition of support for IPv6 addresses really slows down any localhost resolutions. As usual, a great answer on StackOverflow supplied the solution, capturing the IPv6 lookup as well as the standard IPv4. Thanks to guns for the solution.

Basically you need to add a value of ::1 for every localhost value: mydomain.local
::1 mydomain.local

With regards to overriding domains in the hosts file, I have found that in some circumstances, Lion queries the IPv6 address for a domain if it senses that a domain is unreachable over the IPv4 network.

I discovered this when I noticed some ads that I had never seen before on Snow Leopard because I had redirected the ad domains to I fired up wireshark and noticed AAAA (IPv6 DNS records) queries following the IPv4 A queries (IPv4). The ad servers indeed have IPv6 addesses and were able to serve me their content.

The solution to this is have a

entry for every
entry in your hosts file.

Interestingly, if you happen to have a local webserver running on and your browser receives a response from the webserver (error or otherwise), no AAAA query is issued, as it seems to be satisfied that a TCP connection was at least possible.


Leave a Reply