Theres a number of threads discussing slow resolution of /etc/hosts on Mountain Lion. The resolution for my custom host (someserver.dev) is fast when connected to the internet. The moment I go offline the resolution could take up to 30 seconds. Can't seem to find a way to get the resolution to happen quickly without either being online or installing a DNS server.
Asked
Active
Viewed 429 times
2 Answers
2
I've found that the entries in /etc/hosts need to be on individual lines. For instance, I was also having the problem with this config:
192.168.0.13 my1stmachine.local my2ndmachine.local my3rdmachine.local
But after I put each entry on its own line, no slowness anymore:
192.168.0.13 my1stmachine.local
192.168.0.13 my2ndmachine.local
192.168.0.13 my3rdmachine.local
Good luck!

david j
- 46
- 2
-
I tried the same thing when I was first messing with it. Didn't work for me, but I've read reports of it working for other people as well. – Adam Gotterer Mar 14 '13 at 19:24
-
You sir, are a life safer! – Hampei Mar 11 '14 at 12:54
0
Your best option is probably to install a local DNS server like dnsmasq as seen in this blog post by Justin Carmony. It's a bit annoying, but the resolutions come very fast for your local dev servers. You can also do a wildcard entry like this in the dnsmasq.conf file:
address=/.dev/127.0.0.1
So that anything.dev resolves to your localhost. Hope that helps!

Paul Burney
- 1,020
- 11
- 16