OS X DNS Lookups Too Slow for Local Hosts

Comments

I have several local hosts set up on my dev OS X machine. The browser hangs for several seconds while trying to load them. Which doesn’t make any sense, since they are local.

The solution is to change the /etc/hosts file so that all hosts are on one line, the very first line where localhost is defined.

In other words, change from this…

1
2
3
4
5
6
7
127.0.0.1       localhost
255.255.255.255 broadcasthost
::1             localhost
fe80::1%lo0     localhost
127.0.0.1       my-host.dev
127.0.0.1       another-host.dev
127.0.0.1       oh-that-host.dev

…to this.

1
2
3
4
127.0.0.1       localhost  my-host.dev another-host.dev oh-that-host.dev
255.255.255.255 broadcasthost
::1             localhost
fe80::1%lo0     localhost

It still doesn’t make sense, but it works and that’s all that matters.

Answer from Stack Overflow

Comments