< The MacPaw How-tos

How to Clear DNS cache on Mac


clear-dns-cache-on-mac

In this article, we cover the best ways to clear your DNS cache on a Mac, including the different ways you can do that depending on the macOS you are running.

Your DNS cache acts like a memory that your Mac refers to when trying to figure out how to load a website.

Flushing the DNS isn’t a difficult task but the process changes with every new operating system. We’ll walk you through the steps needed to reset your DNS manually in the different versions of macOS and OS X, along with the easy solution of CleanMyMac.

How to clear the DNS: The easy way

For those who want to get this done quickly, a much simpler alternative to clear the DNS cache on all versions of Mac is CleanMyMac.

CleanMyMac is a utility app designed to clean, optimize and maintain your Mac and flushing the DNS cache just so happens to be in its arsenal of features to help you do this.

To flush the DNS cache with CleanMyMac first you’ll need to download it — you can do that here for free.

Then…

  1. Launch CleanMyMac.
  2. Click on Maintenance from the sidebar menu.
  3. Select Flush DNS Cache.
  4. Click Run.

That’s it. Your DNS is all clear and everything should be back to normal. Or you can try one or more of the following methods.

How to clear the DNS: The manual way

Before we get started, note that resetting the DNS cache will interrupt active web browsing activity so it’s worth closing your browser before performing a flush.   

How to flush the DNS cache in macOS High Sierra

1. Open the Finder and go to Applications > Utilities > Terminal.

2. Enter the following syntax at the command line:

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

3. Press Return, enter your password, and press Return again.

4. You should now see a message saying “macOS DNS cache reset.”

5. Exit the Terminal.

How to flush the DNS cache in macOS Sierra

Flushing the DNS cache on macOS Sierra is a near identical process to High Sierra, however, the syntax is different.

1. Open the Finder and go to Applications > Utilities > Terminal.

2. Enter (or copy-and-paste if it’s easier) the following syntax at the command line:

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

3. Press Return, enter your password, and press Return again.

4. Listen out for the audio alert to signal that the cache has been successfully cleared.

If for some reason the above syntax doesn’t work, you can use the following syntax in the Terminal instead:

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

How to flush the DNS cache in Mac OS X El Capitan and Yosemite

The Mac OS X DNS Flush for El Capitan and Yosemite 10.10.4 and newer is thankfully the same. Both versions use the mDNSResponder.

1. Open the Finder and go to Applications > Utilities > Terminal.

2. Enter the following syntax at the command line:

sudo dscacheutil -flushcache;sudo killall -HUP mDNSResponder;say cache flushed

3. Press Return, enter your password, and press Return again.

4. Wait for the audio alert to signal a successful flush.

5. Exit the Terminal.

For OS X Yosemite versions 10.10, 10.10.1, 10.10.2, and 10.10.3 the process is slightly different. To fully flush all DNS caches, you’ll need to clear both the Multicast DNS (MDNS) and Unicast DNS (UDNS).

- Clearing the MDNS cache

Follow the same instructions as above and enter this syntax in the Terminal:

sudo discoveryutil mdnsflushcache

- Clearing the UDNS cache

Follow the same instructions as above and enter this syntax in the Terminal:

sudo discoveryutil udnsflushcaches

- Clearing both MDNS and UDNS caches

There’s also the option to combine MDNS and UDNS commands to flush both caches at once:

sudo discoveryutil mdnsflushcache;sudo discoveryutil udnsflushcaches;say flushed

How to flush the DNS cache in older versions of Mac OS X

Very few people are still working on older versions of Mac, but “very few” is still some. So, for the 3.8% of Mac owners using OS X Mavericks and the 1.6% using OS X Snow Leopard, here are the instructions for an old-school OS X DNS flush.

How to flush the DNS cache in Mac OS X Mavericks

1. Open the Finder and go to Applications > Utilities > Terminal.

2. Enter the following syntax at the command line:

dscacheutil -flushcache;sudo killall -HUP mDNSResponder

3. Press Return, enter your password, and press Return again.

4. Exit the Terminal.

How to flush the DNS cache in Mac OS X Snow Leopard

1. Open the Finder and go to Applications > Utilities > Terminal.

2. Enter the following syntax at the command line:

sudo dscacheutil -flushcache

3. Press Return, enter your password, and press Return again.

4. Exit the Terminal.

Clearing the DNS cache isn’t something you’ll have to do often but it’s a good way to troubleshoot named server errors. Use the correct command for your operating system and you’ll be able to resolve issues within seconds. If, for whatever reason, the command doesn’t work or you don’t feel confident using the Terminal, CleanMyMac will do the job for you.

CleanMyMac rids your system of junk and problematic files to improve performance and keep your Mac running smoother for longer. Download it today to have your computer running on a whole new level.


These might also interest you:



Share it! Knowledge is power:
CleanMyMac 3
How to clean and optimize your Mac?
That's easy. With CleanMyMac 3.
Download Free
MacPaw uses cookies to personalize your experience on our website. By continuing to use this site, you agree to our cookie policy. Click here to learn more.