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 your Mac’s DNS cache.
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 just to be sure.
- 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. You can try out MacKeeper for free, and you get one free fix to see what it can do.
Thankfully, you can flush DNS cache on Macs in just a few short steps. In this guide we’ll show you how to flush the DNS cache on your Mac and cover the following key areas:
- How to flush DNS cache on Mac
- Clearing browser caches with MacKeeper
What is DNS cache?
To understand what a DNS cache is, you first need to know what DNS is. When you load a website, 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.
Why you should clear DNS cache
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.
Flushing your Mac’s DNS cache can eliminate these problems. However, if you do find your browser redirecting to malicious sites, you should also run a malware scan on your Mac.
How to flush DNS cache on Mac
To flush your DNS cache on macOS Big Sur:
1. Click the Spotlight search button or use Command+Space to do a search
2. Type in Terminal, and double-click the Terminal application under Top Hit to open it
Note: If you’re unable to open Terminal through Spotlight, navigate to Go > Utilities > Terminal or click Applications, open the Utilities folder and then double-click Terminal.
3. Once Terminal is open, enter this command: sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
4. Enter your Mac’s password and then press Enter to clear the DNS cache
How to сlear the DNS in older macOS 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
- And 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.
Clearing browser caches with MacKeeper
Clearing browser caches regularly for all your browsers can be time consuming. With a cache clearing tool like MacKeeper, you can clean all caches automatically and get the job done in a snap.
MacKeeper can analyze any files that hog space on your Mac, while protecting you from accidentally deleting important system files.
To get clear your browser caches with MacKeeper:
1. Download and install MacKeeper on your Mac
2. Launch the tool and then go to the Cleaning section in the right pane
3. Click Safe Cleanup
4. Click the blue Start Scan button
5. Next, check the Caches box, and click to select all the caches you want to clear. These include user caches, system caches, mail caches and browser caches
6. Click the blue Clean Junk Files button to confirm your action. MacKeeper will clear all the browser caches and clean any junk files that prevent your Mac from working properly
The bottom line
Clearing your Mac’s DNS cache can help when you’re unable to access a website and you’re not sure what’s causing the problem. With the detailed steps in this guide and cleaning/maintenance tools like MacKeeper, you can resolve the problem, get back to browsing the web and help your Mac run more smoothly.
How often should I flush the DNS cache on Mac?
There’s no recommended time span, but you can do it as often as needed without causing any harm to your Mac.
How do I check my DNS cache on a Mac?
To check DNS cache on your Mac:
- 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
- Go back to the Console app and view the list of cached DNS records
- You can also check DNS cache entries in your web browser. For example, if you’re using Chrome, enter chrome://net-internals/#dns in the address bar to view the current list of cached DNS records
Is it safe to flush DNS cache?
Yes, it’s safe to flush DNS cache on your Mac. Cached data is simply temporary storage, but flushing DNS cache too often prevents it doing its job of speeding up page loading.
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 if you don’t need to.
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.
1. In Safari, go to Safari > Preferences in the menu bar
2. Click Advanced and then tick the Show Develop menu in menu bar box to enable the Develop menu
3. From the menu bar, select Develop > Empty Caches. Once your browser cache is cleared, quit and relaunch the browser
Read more guides: