Troubleshooting DNS on macOS
Below are a few methods and tools to help troubleshoot DNS on a Mac. This includes displaying the current DNS configuration, clearing your DNS cache, how to query a DNS server, and to even view the current DNS cache.
Display DNS Configuration
To display your DNS configuration, run the following command from a Terminal.
Clear DNS Cache
Sometimes you need to clear you DNS cache. In order to do this, run the following commands from a Terminal. Depending on your browser, you may need to also close your browser and clear it's own cache.
Query DNS with nslookup
If you need to do simple lookups you can use nslookup to query a DNS server for a response.
Query DNS with dig
If you need a more advanced view or need to trace the steps of DNS query, the dig tool is very useful.
View DNS Cache
With Windows, you can run
ipconfig /displaydns to view the DNS cache for your local system, but on a Mac it's a bit more complicated. First, open Console, select your local machine, and search for
mDNSResponder. Then open a Terminal and type the command below. This will dump the current DNS cache into the console window.