How to Flush 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 on the latest macOS versions manually.
What is DNS cache
So what’s DNS cache? It’s a list of domain names attributed to your last-visited websites. It’s not the same as recent online history. Domain name information is coded in numbers, for example, 188.8.131.52.
For example, when a website migrates to a new domain, its DNS address changes. Naturally, it becomes unreachable as your still Mac relies on the outdated DNS record.
So, DNS cache is a logbook that translates this numerical information into human-readable website names. After you’ve cleaned the DNS cache, you may notice that some websites load slower — that’s perfectly normal. Your Mac has forgotten them and is trying to access them from scratch.
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 on macOS Big Sur
Are you familiar with Terminal? If not, no problem. All you’ll need to do is launch the Terminal app and paste in a couple of commands.
- Open the LaunchPad in the Dock and type in Terminal in the search bar.
- Enter the following syntax at the command line:
- Press Return, enter your password, and press Return again.
- Exit the Terminal.
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
How to clear the DNS: The easy way
As we've explained above, you can auto-delete these outdated cache files with an app. To our knowledge, the only app that does it is CleanMyMac X by MacPaw. This is a well-known Mac maintenance app that also is notarized by Apple.
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, all you’ll need to do is download it — you can do that here for free.
Another thing worth trying is clearing the browser cache itself (not the same as clearing the DNS list). You can do it automatically for all browsers if you open CleanMyMac X.
This should potentially:
- Fix small access-related issues
- Free up space
- Run CleanMyMac X.
- Click the System Junk tab in the sidebar.
- Look through the list of found items and click Clean.
It should be pretty easy — everything should be back to normal. Or you can try one or more of the following methods.
How to clear the DNS on older macOS versions
The algorithm is the same, only the copy/paste command in Terminal will be different for each OS.
|macOS or Mac OS X version||Terminal command|
macOS High Sierra
OS X Mountain Lion
Mac OS X Lion
|Mac OS X El Capitan|
OS X Mavericks
|OS X Yosemite|
|Mac OS X Snow Leopard|
Mac OS X Leopard
|Mac OS X Tiger|
How to flush DNS cache on Linux
Before clearing the DNS cache on Linux, you need to ensure that systemd-resolved is active. Open a terminal window, and enter this command:
sudo systemctl is-active systemd-resolved
If you see "active," enter the command to flush the DNS cache:
sudo systemd-resolve --flush-caches
There's no success message, but you can check whether that has worked by running the next command:
sudo systemd-resolve --statistics
If you see that the Current Cache Size is at 0, you've successfully flushed all DNS cache.
Frequently Asked Questions
When should you flush or reset the DNS cache?
Flushing the DNS makes sense when you can’t open certain websites. Especially if they were perfectly available just a moment ago. You can also try this fix when your network slows down randomly or other network-related issues occur.
What will happen if I flush my Mac’s DNS cache?
Flushing the cache simply updates the entry on your Mac that corresponds to the server address. Next time you try to access this server i.e., a website, it will load a bit slower —which is similar to clearing your browser cache.
What are the alternatives to flushing the DNS cache on Mac?
If the above methods seem too technical, you may try to do a hard refresh in your browser. Another way to refresh outdated DNS entries is to delete browser caches.
Clearing the DNS cache on Mac 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 X will do the job for you.