How to Clear & Reset DNS Cache in MacOS Sierra

Mac OS users who have modified their DNS settings may need to clear their DNS cache before the changes take effect.  Additionally, sometimes name servers and domains may not resolve as intended if you have stale DNS cache on the Mac, another situation where resetting DNS cache can often be the solution. 

We’ll show you how to flush out DNS cache in MacOS Sierra 10.12 and later. 

Note: this uses the command line and thus is aimed at more advanced users.  It’s fairly rare that a novice Mac OS user would need to reset their DNS cache anyway, but often just rebooting will achieve the same effect. 

How to Clear DNS Cache in MacOS Sierra

Open the Terminal application, found in the Utilities folder within Applications

Enter the following command syntax exactly (use copy and paste if in doubt about syntax accuracy):

sudo killall -HUP mDNSResponder;say DNS cache has been flushed

Hit the Return/Enter key and enter the admin password when requested (this is necessary because of sudo privileges)

Wait a few moments for the DNS cache to be cleared

You will get a verbal audio alert the DNS cache has been flushed when complete. 

This can be particularly important if you have recently made changes to DNS servers in Mac OS and are finding the changes have not taken effect, but is also frequently used by web developers, programmers, and designers who are working with domain names or after editing the hosts file. 

Though it’s not always necessary, you may need to quit and relaunch any active applications which are using DNS or networking, including Safari, Chrome, Firefox, Opera, sFTP, SSH, and other similar tasks dependent on domain name correspondence. 

Rarely the above command may not work, but an alternative command is available for macOS Sierra 10.12.3 and later that adds an additional focus on a helper process as well, that syntax is:

As before, hitting return will execute the command syntax and reset the DNS caches in MacOS 10.12.4 and newer releases. 

Remember, this tip is intended for modern versions of macOS including Sierra 10.12 and later.  Earlier versions of MacOS often have completely different methods of resetting DNS cache as described here, though since some of the earlier releases are still in deployment it can be valuable to know those methods as well. 

Have any comments or tricks to reset DNS cache in MacOS?  Let us know in the comments! 

How about “sudo rndc reload”?  That seems to work at least as far back as 10.8, which is what my DNS server is on.  Did it get removed from later versions?  Or is there a new bug in mDNSResponder that causes it to not listen to named changes? 

Type “rndc” with no args to see a list of commands.  Type “man rndc” to see a list of command-line options. 

This website and third-party tools use cookies for functional, analytical, and advertising purposes.  By continuing to browse the site, closing this banner, scrolling this webpage, or clicking a link, you agree to these cookies.  You can review our privacy policy for additional information. I AcceptPrivacy Policy