0

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.

Community
  • 1
  • 1
Adam Gotterer
  • 598
  • 5
  • 19

2 Answers2

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
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