Mac Performance

How to Flush your DNS Cache on Mac

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.

 

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:

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

menu bar spotlight highlighted

2. Type in Terminal, and double-click the Terminal application under Top Hit to open it

spotlight search terminal

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.

utilities folder terminal app highlighted

3. Once Terminal is open, enter this command: sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder

terminal window

4. Enter your Mac’s password and then press Enter to clear the DNS cache

terminal window with password option highlighted

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

mackeeper safe cleanup

4. Click the blue Start Scan button

safe cleanup start scan button highlighted

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

safe cleanup caches tab

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

safe cleanup clean junk files button highlighted

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.

FAQs

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

safari preferences

2. Click Advanced and then tick the Show Develop menu in menu bar box to enable the Develop menu

safari preferences Show develop menu in menu

3. From the menu bar, select Develop > Empty Caches. Once your browser cache is cleared, quit and relaunch the browser

safari empty caches

Read more guides:

arrow

Run Application

step_1

Click Continue

step_2

Click Install

step_3