MacOS – the equivalent of ipconfig/displaydns (and flushdns) in OS X

dnsmacosterminal

I need to find how to display my DNS cache on the mac. I have tried
multi Google searches but failed to come up with a good solution.
The best I found was how to remove the cache with the command
sudo killall -HUP mDNSResponder which is great but I need to see the cache to see if the change works.

Best Answer

As @PrasseethaKR and @kjagiello point out, on High Siera mDNSResponer has moved from syslog to log function. In addition, your DNS lookups are now considered private and will show as such in both Console and log stream.

To view your DNS lookups in real time on High Sierra open an Terminal and run:

sudo log config --mode "private_data:on"
log stream --predicate 'process == "mDNSResponder"' --info

To go back to using private just run the following command.

sudo log config --mode "private_data:off"

AFAIK you cannot view the contents of old private messages, only messages logged with private_data:on can appear. To view your entire history use the show command Because it can return a large amount of data I also use --last to limit the data, e.g. the last 2 hours would be...

log show --last 2h --predicate 'process == "mDNSResponder"' --info

Cheers!