How to Clear & Reset DNS Cache in MacOS Sierra

Mar 8, 2017 - 10 Comments

How to clear 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

  1. Open the Terminal application, found in the Utilities folder within Applications
  2. Enter the following command syntax exactly (use copy and paste if in doubt about syntax accuracy):
  3. sudo killall -HUP mDNSResponder;say DNS cache has been flushed
    Clear DNS Cache in MacOS

  4. Hit the Return/Enter key and enter the admin password when requested (this is necessary because of sudo privileges)
  5. 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:

sudo killall -HUP mDNSResponder;sudo killall mDNSResponderHelper;sudo dscacheutil -flushcache;say MacOS DNS cache has been cleared

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!


Related articles:

Posted by: Paul Horowitz in Command Line, Mac OS, Tips & Tricks


» Comments RSS Feed

  1. Alex says:

    Does this command delete private browsing history?

  2. Kent Ketell says:

    It’s important to note that “kill” is different from “kill -HUP”.

    Sending a HUP to the process causes it to flush the cache, but does not restart the process.

    Just using “kill” sends a TERM instead of a HUP, which actually kills the process, which is then restarted by the launcher. Yes, this effectively clears the cache, but it is not as friendly.

  3. Nate says:

    dscacheutil -flushcache works fine too. It has for many many yearrs.

  4. Jan Steinman says:

    That seems rather brutal and heavy-handed!

    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.

    • Willdon says:

      In macOS Sierra (10.12.4): rndc -bash: rndc: command not found

      DNS in macOS is handled through mDNSResponder, killing the process has always been the way to reset DNS cache on a Mac (aside from rebooting and changing DNS settings which is way more laborious)

  5. e01 says:

    Instead of regular tip of how to clean DNS cache, explain users why /etc/hosts is not respected from some of components and even Safari.

  6. Frank says:

    Shouldn’t’ be like “sudo killall -u _mdnsresponder mDNSResponder” ?

    • Kellen says:

      sudo killall mDNSResponder worked for me in Siera, flushed the cache immediately. Didn’t even need to relaunch Safari for change to take.

    • Rich says:

      This worked for me where my DNS was failing randomly. Chrome worked but Safari and Ping etc. could not find the server.

Leave a Reply


Shop on and help support OSXDaily!

Subscribe to OSXDaily

Subscribe to RSS Subscribe to Twitter Feed Follow on Facebook Subscribe to eMail Updates

Tips & Tricks


iPhone / iPad



Shop on Amazon to help support this site