Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I typically determine the IP of a host by doing: $ host -t A example.com. Is there a more verbose version of this that tells me whats happening in the background, specifically the order of what is queried (/etc/hosts 1st, dns server 2nd)?

As many people can attest to, OS X Lion resolves local /etc/hosts entries painfully slow, and I'd like to see what bottlenecks are causing this. Seems like in theory, /etc/hosts should be queried first and name resolution should happen instantaneously for manually entered hosts.

share|improve this question

Since Apple has done away with nsswitch.conf in Lion, you can view the resolver order with scutil --dns.

My guess is you will see "DNS" listed before "local".

It's a bit of a hack, but you can install DNSMasq on your OS X host and have your system query it for DNS resolution. DNSMasq can read /etc/hosts first and serve up the entries it finds there before searching DNS. This restores the proper order to resolution.

The gentleman who wrote this blog has done all of the hard work for you. He describes how to install DNSMasq and configure it on OS X Lion.

share|improve this answer
This is very helpful. Thank you! – Michael M May 15 '12 at 3:53
... Why in the name of Saint Carl the Far-Seeing and Saint Frederick the Compassionate did they dump a perfectly functional resolution mechanic in exchange for scutil ? – Shadur May 15 '12 at 8:25
@Shadur just remember they have their own keyboard layout and have given up on non-glossy displays, that should suffice to understand... – Shadok May 15 '12 at 12:09
@Shadur Ask Different. apple.stackexchange.com :) – uther May 15 '12 at 12:48

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.