How to Reset DNS Cache in macOS High Sierra

Dec 18, 2017 - 13 Comments

Terminal in macOS

Need to reset and clear DNS cache in macOS High Sierra? Some Mac users may need to occasionally reset their local DNS cache, typically because the Mac DNS settings have changed, or a particular name server or domain is cached and they need to flush existing DNS cache.

While it’s most often web developers, systems administrators, and network admins that fiddle with DNS and have to reset and clear their DNS caches, sometimes other Mac users need to clear the DNS caches as well.

In macOS High Sierra, you can reset DNS cache by targeting the mDNSResponder process via the command line available in Terminal app. This is similar to clearing DNS cache in macOS Sierra and El Capitan, though the process to reset DNS cache has changed many times throughout the history of the Mac OS and Mac OS X operating system.

How to Reset DNS Cache in MacOS High Sierra

Note that resetting and flushing DNS cache will likely interrupt any active internet activity or usage.

  1. Launch the Terminal application, it is found within the /Applications/Utilities/ folder on a Mac
  2. Flushing DNS cache is done via Terminal in macOS

  3. At the command line, enter the following syntax:
  4. sudo killall -HUP mDNSResponder; sleep 2; echo macOS DNS Cache Reset | say

  5. Hit the Return key and then enter the administrator password, then hit return again
  6. Reset DNS cache in macOS High Sierra

  7. Wait a moment, when you see the text “macOS DNS Cache Reset” appear in Terminal the DNS cache reset has been successful
  8. Exit Terminal

You may need to quit and relaunch certain internet connected applications for the changes to take effect, though most web browsers can suffice with a simple refresh.

If the above approach doesn’t work for whatever reason, you can break the command syntax down into smaller components:

sudo killall -HUP mDNSResponder && echo macOS DNS Cache Reset

This applies for macOS High Sierra, which is versioned as Mac OS 10.13.x. Users interested in learning how to reset DNS cache in prior versions of MacOS can learn how to do so for Sierra, El Capitan, Yosemite, and earlier versions of Mac OS X if desired.


Related articles:

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


» Comments RSS Feed

  1. David says:

    Make short you are only copying the words (or letters), the command does not like extra spaces at start or Finnish of it .

  2. Ashwin Prakash says:

    My DNS gets changed everytime I connect to internet. The DNS is invalid and I usually clear it DNS Server tab everytime. Can anyone help me on this

  3. AnonymousIT says:

    Thank You!

    (For the Complainers.. see above, this is where your post should end! on this page and all others you were offered a solution to YOUR question/s)

    Knowledge is power, one day you will use this “say” command doesn’t matter when/why be thankful for the shared knowledge.

  4. Kerrie says:

    Thankyou so much! This was my third attempt at finding a script that would work in High Sierra.
    I was actually appreciative of the voice result. In previous versions of this type of code, apparently there was no visible success line. So I knew it had worked here. I don’t know why people are complaining instead of being grateful for your help. We seem to be living within a Culture of Complaint…. Again, many thanks!

  5. BM says:

    Why the ridiculous sleep then a say command. Literally 2/3 of that command is redundant. I wanted to know how to clear my DNS cache, not perform some stupid party trick.

  6. JP says:

    Why the `say` command? Thats dumb, you don’t need to add stupid things that are funny.

    • Bob says:

      that aren’t* funny

      • Borlo says:

        The command is meant to clear the DNS cache and reset DNS cache in macOS HIgh Sierra, it is not meant to be funny or not funny.

        sudo killall -HUP mDNSResponder; sleep 2; echo macOS DNS Cache Reset | say

        The command as written will reset the DNS cache in High Sierra, and when it is complete the command will report back when the DNS cache reset was successful.

        Another option to reset the DNS cache in macOS High Sierra is this command:

        sudo killall -HUP mDNSResponder; echo macOS-DNS-Cache-Clear

        I don’t understand the hubbub but a lot of people don’t understand how the command line works so that’s probably why they’re confused.

        • Robin says:

          This is what happens when I input above command (I copied and pasted to be sure it was correct)
          sudo: command not found
          sleep: command not found
          say:command not found

          Any ideas?

  7. MadMartian says:

    Wow! that’s incredibly handy! I had no idea I could make my Mac talk!

  8. Mark W says:

    echo that was stupid | say

  9. Gill B says:

    I don’t understand why you would want your machine to “say” it’s flushed the dns??

  10. Bill G says:

    The command is the same in Sierra and High Sierra.

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