Can't resolve localhost on Mac OS X Server

I had this same issue with Mountain Lion (10.8.2). I solved it by by disabling "Stealth Mode" in Security & Privacy -> Firewall -> Firewall Options.


This is probably not related to your original question, but there is another issue that can affect DNS lookups in Mac OS X Lion, specifically localhost or any other entries you may have in /etc/hosts.

Apparently the /etc/hosts file no longer supports multiple domains per line in the file, so every record needs its own line:

127.0.0.1 localhost
127.0.0.1 some.site.local
127.0.0.1 some.site.dev

Found this via Justin Carmony's blog. He goes on to describe some other "interesting" behavior if you're using /etc/hosts, so read up if you're still having issues.


I know it's a little late, but in my case, changing the line endings to UNIX, replacing tabs with spaces and saving the file as UTF-8 made it work on Mountain Lion (10.8.2)

Hope this work for someone else.