What command line command do I use to lookup a domain address?
When looking at the man pages for nslookup and dig I can see a section saying that these utilities do not use the Mac OS methods of finding names.
So, what command should I be running?
Ask Different is a question and answer site for power users of Apple hardware and software. It only takes a minute to sign up.Sign up to join this community
dig are perfectly good DNS query tools in OS X, but they all query DNS directly rather than going through OS X's internal resolution system. As a result, they don't check the /etc/hosts file, or resolve Bonjour/mDNS names (those ending in .local). The standard (quick 'n dirty) way to test resolution is to use
ping, since it'll resolve the address you give it through the usual system before attempting to ping it. If you want something intended for the purpose, use
$ dscacheutil -q host -a name www.apple.com name: e3191.c.akamaiedge.net alias: www.apple.com www.isg-apple.com.akadns.net www.apple.com.edgekey.net ip_address: 22.214.171.124 $ ping www.apple.com PING e3191.c.akamaiedge.net (126.96.36.199): 56 data bytes 64 bytes from 188.8.131.52: icmp_seq=0 ttl=57 time=57.258 ms ^C --- e3191.c.akamaiedge.net ping statistics --- 1 packets transmitted, 1 packets received, 0.0% packet loss round-trip min/avg/max/stddev = 57.258/57.258/57.258/0.000 ms