How to Reset DNS Cache in macOS High Sierra

Dec 18, 2017 - 6 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.

Enjoy this tip? Subscribe to the OSXDaily newsletter to get more of our great Apple tips, tricks, and important news delivered to your inbox! Enter your email address below:

Related articles:

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

6 Comments

» Comments RSS Feed

  1. Bill G says:

    The command is the same in Sierra and High Sierra.

  2. Gill B says:

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

  3. Mark W says:

    echo that was stupid | say

  4. MadMartian says:

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

  5. JP says:

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

  6. 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.

Leave a Reply

 

Shop for Apple & Mac Deals on Amazon.com

Subscribe to OSXDaily

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

Tips & Tricks

News

iPhone / iPad

Mac