Back in March I made the switch from Windows to OS X when I purchased my 13″ Macbook Pro. Since then I’ve trying to configure my ideal development environment, which has mostly meant deciding on the code editor that best suits my needs and workflow. I’ve been using XAMPP for my LAMP stack and so far things have been great. That is, until I upgraded to Lion a few months ago.
After making the upgrade to OS X 10.7 I soon noticed some of the websites running on my local server become incredibly slow. The most annoying part was trying to access phpMyAdmin to browse tables and run SQL queries. Sometimes accessing these local sites would be instant and other times they would hang for a few seconds before loading.
I turned to Google and searched for things such as “OS X Lion Apache slow after upgrade” and “Lion lookup slow”, but ever found useless posts related to people with slow internet connections not being able to download the Lion upgrade installer. At one point I tried reinstalling XAMPP and after that failed I started to consider the idea of reinstalling a clean copy of Lion. Thankfully I never did because today I discovered this Stack Overflow post after googling “Local DLS slow OS X Lion”.
The Problem
Basically Lion handles .local TLDs differently to Snow Leopard. Whenever I would try to access my phpMyAdmin installation at http://xampp.local/phpMyAdmin, Lion would take a ridiculously long time to resolve the host and it probably has something to do with the Multicast DNS feature of Bonjour. You can read more about Bonjour and the .local TLD here.
The Solution
The easiest solution is to simply stop using the .local TLD for your virtual hostnames. You could use an alternate TLD such as “.dev”, but further reading has hinted that inventing your own TLDs is a bad idea altogether due to potential naming conflicts. The recommended solutions that prevent these naming conflicts are overkill for my small development environment, so I’ve simply chosen to go against the advice and use a different TLD for my virtual hosts.

Hey Matt,
I just wanted to say, thank you so much! I’ve had the same issue, and until now had no success googling for an answer. Who’d have thought it was a .local TLD problem!?…
Thanks!
Chris
Awesomeness, this solved my problem. I suspected that this might be the issue, but never thought to look into it.
Thanks,
Kacy
Pingback: Slow Virtual Hosts in OS X Lion « Kacy's Blog
Awesome!
Thank you, like you I googled a thousand useless posts – all fixed now
Thank you! I was already depressed trying to figure out what the hell was going on
Pingback: Slow Apache web server on OSX Lionbase42.nl
also: turn off IPv6 or add localhost IPv6 address to hosts file