Fix? Mac OS X Lion, .local domain hell

Ran across this blog entry that showed a “fix” for OS X Lion and how it will consider Multicast DNS first before /etc/hosts lookup.  At my employer we use .local domain within our corporate environment and this causes all sorts of pain with Capistrano deployments, development environments, etc.  All .local domains are technically really only reserved for Multicast DNS but Lion doesn’t trust /etc/hosts first and insteads makes you wait up to 5 seconds before looking at your entries.

Begging IT to change our FQDN on our network takes time, so in the meantime there is a dscl command you can use to help.

sudo dscl localhost -create /Local/Default/Hosts/mydev.local IPAddress 127.0.0.1

To see all the currently defined hosts and their IPs

sudo dscl localhost -list /Local/Default/Hosts IPAddress

And to remove a host:

sudo dscl localhost -delete /Local/Default/Hosts/mydev.local

Thanks to http://itand.me/ for this information.

05. November 2011 by thehar
Categories: Hacks, OS X Lion | 2 comments