Most of the time, your Mac’s DNS cache isn’t something you need to worry about. It works quietly in the background, sending you to the right websites when you ask for them. But if it gets corrupted, then you can run into problems loading sites, with 404 errors being common. One solution is to clear the DNS cache on your Mac.
You can flush the DNS cache on your Mac by using the Terminal app. However, the steps you should follow are different for older macOS versions (e.g. macOS Catalina) compared to the new ones like Sonoma and Ventura. But worry not, below we’ll cover it all for you. Now, let’s look at the symptoms that suggest it’s time to clean the DNS cache in macOS, along with how you can actually do that.
Continue reading to learn in more detail how to clear cache on Mac.
Before we start
If you’re flashing your DNS cache because you’re experiencing problems, you might have malware on your Mac. It’s worth running a scan with MacKeeper’s Antivirus just to be sure:
- Download MacKeeper.
- Open MacKeeper and select Antivirus from the menu.
- Click Start Scan.
- Wait for the scan to finish.
- If MacKeeper finds any suspicious files, take the recommended actions.
Hopefully, your Mac is free of malware, but you should always make sure it’s protected. Try out MacKeeper and get one free fix to see what our professional antivirus software can do.
In this article you will find the following:
What is a DNS cache?
To understand what a DNS cache is, you first need to know what DNS is. When you load a website on your MacBook, you connect to a DNS (Domain Name System) server online. This looks at the web address in your browser, and it then checks that against a database of IP addresses. These IP addresses tell your web browser where to find the server that contains that website. This process is called a DNS lookup.
The DNS cache is a temporary database on your computer of all the recent DNS lookups it’s carried out. This enables your browser to resolve these lookups faster, thereby cutting down web page loading times.
How to check DNS cache on Mac
It’s important to check the DNS cache on your Mac before freeing up space, as you’ll then be able to determine whether you actually need to take action or not. Here’s how to check DNS cache in Mac before you delete anything:
- Open the Console app, select your Mac, and then enter any:mdnsresponder in the search bar.
- Open a Terminal window, and enter sudo killall –INFO mDNSResponder.
- Enter your password when prompted. Note that the password won’t appear on your screen, but if you type it correctly and press the Enter key, you should still be fine.
- Go back to the Console app and view the list of cached DNS records.
You can also see the DNS cache on your Mac via your web browser. For example, if you’re using Chrome, enter chrome://net-internals/#dns in the address bar to see the list of cached DNS records.
Should you flush the DNS cache on Mac?
Over time, the DNS cache can become outdated or corrupted—leading to connectivity problems. It can also be affected by malware, causing your browser to take you to malicious sites or phishing schemes.
Performing a Mac DNS cache reset can eliminate these problems. However, if you do find your browser redirecting to malicious sites, it’s not enough to clear cache on your Mac. Also, our team suggests you run a malware scan on your Mac with the help of MacKeeper’s Antivirus.
Here are some of the common internet browsing problems that you can fix when your Mac refreshes the DNS:
- DNS spoofing
- Error 404
- Trouble accessing websites
- Your search behavior not being private
- DNS record propagation
Now, let’s look at each of these issues—and how to prevent them—in further detail.
1. Prevent DNS spoofing
DNS spoofing involves a criminal using your DNS records to load malicious websites on your device. These redirects occur even when you type perfectly legitimate URLs, and they can lead to both fraud and performance-related problems for your computer.
2. Error 404
Error 404 is one of the most common internet browsing issues, and it typically occurs when a page on the website you’re trying to visit is no longer available. Although 404 errors are often reasonable, you can sometimes see the problem if you don’t regularly empty the DNS cache on your Mac.
3. Trouble accessing a website
Besides seeing 404 errors, web pages might take a long time to load if your DNS cache is full. Long loading times will become irritating over time and stop you from getting the information you require. So, it’s in your best interests to view the DNS cache on Mac and refresh when you feel like it’s becoming an issue.
Hint from our team:
If you’re having slow internet problems, you can perform numerous other steps to get back on track. For example, try turning off your VPN or resetting your Wi-Fi router.
4. Keep the user's search behavior private
When you surf the web, others can see your online activity—especially when you use a public Wi-Fi network. But even if you don’t, advertisers and other third parties can view your search information via your IP address. One way to tackle this is to clean the DNS cache on Mac. This way, advertisers will find it harder to see your search behavior, and so will your internet provider.
5. Prevent DNS record propagation
DNS propagation refers to the time required to update your online DNS records. If you want to remain more private online, clearing your DNS cache can stop propagation. The reason is that it takes time to successfully update your records.
How to clear DNS cache on Mac manually
The steps to empty the DNS cache on your Mac can vary depending on your macOS version. For your convenience, our experts have divided the instructions on how to perform the Mac delete DNS cache process for various iterations of macOS.
Delete your DNS cache in recent versions of macOS—Sonoma, Ventura, Monterey & Big Sur
For newer macOS versions (2020 and later), you’ll need to follow the instructions explained below:
- Click the Spotlight search button in the toolbar at the top. Alternatively, use Command+Space to do a search.
- Type in Terminal, and double-click the Terminal application under Top Hit to open it.
- Once Terminal is open, enter this command: sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder.
- Enter your Mac’s password and then press Enter to clear the DNS cache.
Clear the DNS in macOS Catalina and older versions
Older macOS versions use different commands. To flush the DNS cache in these older versions, enter these in Terminal:
- In macOS El Capitan or newer, run sudo killall -HUP mDNSResponder.
- For macOS Yosemite, enter sudo discoveryutil udnsflushcaches.
- In Mac OS Lion, Mountain Lion and Mavericks, the command is sudo killall -HUP mDNSResponder.
- In Mac OS Snow Leopard, enter sudo dscacheutil –flushcache.
- For MacOS Leopard, run sudo lookupd –flushcache.
- In Mac OS Tiger, use lookupd –flushcache.
Once you’ve flushed the DNS cache on your Mac, check the problematic website to see if the problem is fixed, and you’re able to visit the site normally again. If you’ve been wondering why your Safari is so slow and the problem persists post-DNS cache clearing, try other solutions. For example, delete needless extensions and close energy-consuming apps.
Flushing your Mac DNS cache: Easy and essential
You should see the DNS cache on Mac as a good starting point for solving issues you may have while browsing the web. For example, web pages that won’t load properly are often a symptom of a DNS cache that requires a clearout.
If clearing the DNS cache didn’t work, your Mac could have bigger problems that you must address. Malware might be one of these, and you can check for viruses and whatnot with MacKeeper’s Antivirus. Our tool automatically searches for and quarantines malware, enabling you to do the easy work of removing it and enjoying your browsing experience once more.
FAQs
1. How often should I flush the DNS cache on Mac?
There’s no recommended time span. You can purge your Mac’s DNS cache as often as needed without harming your device, and it’s a good idea to do it every six months or so.
2. Is it safe to flush DNS cache?
Yes, it’s safe to flush DNS cache on your Mac. Cached data is simply temporary storage. Having said that, you shouldn’t clear the DNS cache every day, as this would stop it from doing its job of making the page load faster.
Besides, clearing your Mac’s DNS cache can help you hide your search behavior, protect against manipulation by cybercriminals, and solve technical problems when accessing web apps. But there’s no point in doing it all the time if you don’t need to.
3. How do I clear DNS cache in Safari?
Safari browser also keeps a DNS cache. When you restart the browser, it clears the cache automatically, but you can do the same manually without relaunching the app.
- In Safari, go to Safari > Settings in the menu bar.
- Click Advanced and then tick the Show features for web developers box to enable the Develop menu.
- From the menu bar, select Develop > Empty Caches. Once your browser cache is cleared, quit and relaunch the browser.
Once you’ve cleared the DNS cache in Safari, you should find that your browser runs much more effectively than before.