Sign up ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

In Mac OS X, how do I check what DNS server I'm currently using (preferably a command line solution)?

System Preferences > Network shows, which is my router's address and not the real DNS server.

share|improve this question

migrated from Mar 16 '11 at 3:39

This question came from our site for system and network administrators.

5 Answers 5

up vote 46 down vote accepted

You could try issuing a scutil --dns | grep 'nameserver\[[0-9]*\]' at the command line. Should give you a list of DNS servers configured on your system.

share|improve this answer
that's a great command - it looks like that is the DNS server used by Comcast (my ISP). +1 for a great bonus point and what appears to be a deeper knowledge answer. – mjb Mar 16 '11 at 4:14
+1 For a command that shows the servers for “multi-client” configurations (e.g. /etc/resolver/…). – Chris Johnsen Mar 16 '11 at 4:37
I've added | sort | uniq to it as I was only interested in the unique DNS servers used. – Jeroen Wiert Pluimers Aug 23 at 6:11

Your router is acting as a DNS forwarder, you ask your router and your router asks a DNS server for you. You need to login to your router web config to figure out what it's using, or you could just enter it directly into your Network configuration.

share|improve this answer

Use the following command to view your DNS server in Mac OS X :

Open the terminal and type

$ cat /etc/resolv.conf

to view your DNS server.

Sample output :

$ cat /etc/resolv.conf 
domain (Here, you can see DNS records info of the particular domain name.)
share|improve this answer
This will show the same thing that System Preferences > Network does. – Kevin Panko Dec 16 '13 at 19:14

Akamai provides a DNS debugging tool which returns the IP address of the resolver used for the query. Open and run the following command:

dig +short

UltraDNS also provides one, but I've found it to be less reliable:

dig +short

The IP address returned by these tools is a DNS resolver in use for your network, but may be only one of several. There might be an advantage to using the IP in your Network preferences directly.

You can benchmark the performance of your local and alternate DNS servers using namebench.

share|improve this answer
Excellent. This saves the time of accessing the router admin screen. – downeyt May 19 at 14:29

That is the DNS server your mac is using. Your router is running a caching DNS server, and setting itself as the DNS server via DHCP. If you login to your router, you might be able to find out which DNS servers it uses.

share|improve this answer

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.