How to flush the cache of the DNS system on a macOS Sierra or High Sierra Mac?
I have seen discussion of the following, but am not sure if this is the modern approach. And I am not sure what each does exactly.
sudo dscacheutil -flushcache
sudo killall -HUP mDNSResponder
Best Answer
sudo dscacheutil -flushcache
does nothing useful related to DNS cache entries - at least in non-LDAP environments and 10.9-10.13.sudo killall -HUP mDNSResponder
sends a hang up to mDNSResponder, launchd will restart the daemon and the DNS cache will be cleared as spillover effect.This can easily be tested with the following command sequence:
To get the results above open Console.app, choose your hostname in "Devices" and use a filter mDNSResponder & Cache size: