Flush DNS cache on your Mac

81.0K views
7 min read

Even though using Macs for our day-to-day needs doesn’t require us to know anything about what’s going on under the hood, having an idea about a few macOS building blocks, such as DNS cache, can help us quickly fix common problems when we encounter them. 

One of the issues that lots of users can’t solve on their own is flushing DNS cache. Let’s dive into what DNS cache is, why it needs to be flushed, and how to do it in the most effective way. 

Problems with flushing DNS cache

How to resolve

Junk and malware removal challenges

Install and open CleanMyMac X. Go to Maintenance > Select Flush DNS Cache > Run.

Unfamiliar DNS cache flushing on macOS Big Sur and later

Launch Terminal > Type sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder > Enter password > Return. Alternatively, use Core Shell, a full-featured SSH terminal.

Terminal commands failure on macOS Catalina and earlier

Launch Terminal > Type sudo killall -HUP mDNSResponder > Enter password > Return.

Flushing DNS cache not improving Mac performance

Monitor and optimize Mac systems, including RAM and CPU, with iStat Menus.

What is DNS cache?

DNS (domain name system) is a system of interpreting domain names (e.g. example.com) into the language that computers and routers can understand (e.g. 93.184.216.34). 

You can think of DNS as an address book for the web. When you visit a website for the first time, your Mac saves the route between the domain name and IP for faster loading in the future. This is what DNS cache is. 

Why you should flush DNS cache

Now we know that DNS cache helps Mac speed up website loading. Then why would you want to flush DNS cache Mac saves? 

Over time, websites tend to change their IP addresses. It could be because they have dynamic IPs, moved to a different registrar, or switched hosting companies. 

Similarly, your browser that keeps the IP address routes to all the websites might have a glitch and not resolve them properly. 

In cases like these, restarting your browser or Mac can help, but if you know how to flush DNS Mac keeps, you can solve the problem immediately. 

How to flush DNS cache on Mac in one click

You might wonder how do you manually clear DNS cache Mac saves and where do you even find DNS cache on Mac? 

There’s no need to worry about any of this once you have CleanMyMac X. 

CleanMyMac X is the ultimate Mac optimization app that lets you manage anything, from accumulated junk to malware removal to system errors. All you need to do is select an appropriate scan from the menu and run it. 

Here’s how to Mac flush DNS cache with CleanMyMac X: 

  1. Launch the app
  2. Go to the Maintenance tab 
  3. Select Flush DNS Cache
  4. Click Run

cleanmymac x flush dns cache mac

How to clear DNS cache manually

While not recommended, it’s possible to Mac clear DNS cache manually without using tools like CleanMyMac X. 

The way the OSX flush DNS cache happens will differ based on the macOS you’re running — whether it’s Big Sur and later, or Catalina and earlier. 

You can check your version of macOS by clicking on the Apple icon in the menu bar and then About This Mac. 

about this mac macos

How to flush DNS cache on macOS Big Sur and later

The way you flush DNS on Mac is by entering a specific command into the Terminal, which changes depending on the operating system you have installed. 

To flush DNS Mac cache on macOS Big Sur and later: 

  1. Launch Terminal
  2. Type: sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
  3. Enter your user password
  4. Press Return

terminal flush dns mac

If you use Terminal a lot, you might be interested in augmenting your workflow with a full-featured SSH terminal as well. Try Core Shell. 

Core Shell makes managing SSH connections easy, from proxy jumps to agent forwarding to organizing everything by tags. You also get one-click logins, automatic reconnects, and color customization. Plus, Core Shell integrates with macOS keychain. Give it a try! 

core shell ssh terminal macos

How to clear DNS cache on Catalina and earlier

If you’re running an older macOS, you can still flush DNS Mac cache using Terminal, but the commands you need to use will be different. 

To Mac flush DNS cache on macOS Catalina down to El Capitan: 

  1. Launch Terminal 
  2. Type: sudo killall -HUP mDNSResponder
  3. Enter your user password
  4. Press Return

terminal old flush dns cache mac

For those running macOS Yosemite, the command will change to: sudo discoveryutil udnsflushcaches. For those on macOS Mavericks: sudo killall -HUP mDNSResponder. 

Bonus tips for fast Mac performance

One of the key aspects of improving Mac performance is monitoring. If you don’t know what’s lagging behind, how can you make it better? 

iStat Menus is the most advanced real-time Mac monitoring system, keeping track of everything from RAM to CPU, to disk health, to network, to sensors. 

You don’t need to do anything to run iStat Menus. It lives in the menu bar and provides you with up-to-date graphs and detailed stats in one click. 

istat menus monitor mac

Another big performance and security improvement for your Mac is having recent backups. In case there’s hard drive failure, malware attack, or any other system glitch, you want to have all your data stored safely off your Mac. 

Get Backup Pro is a simple but powerful solution when it comes to backing up your Mac. It’s easy to use and supports all kinds of backup options, from incremental to simple copy, to clone, to versioned. You can even synchronize folders with other Macs and scheduled backups in advance. In case a disaster strikes, bootable backups can get you started safely with all your data in no time. 

get backup pro

Best of all, the apps mentioned above are available to you free for seven days with the trial of Setapp. Setapp is a platform of more than 240 outstanding Mac and iOS apps across all categories. Give the collection a try and find your new favorites.

FAQ

Where is my DNS cache on Mac?

DNS cache references are stored deep inside your system folders, which makes them hard to see and hence requires using Terminal or CleanMyMac X to delete them. 

Is it safe to flush DNS cache?

Yes, flushing the DNS cache properly is safe. However, since there’s more risk of entering the wrong command into Terminal, we suggest using CleanMyMac X to do it. 

How do I know if my DNS cache is cleared?

If you had a problem with loading specific websites, flushing the DNS cache should resolve it. Other than that, you might notice that the website will load somewhat slower at first, since your Mac needs to route IPs to domain names once again. 

You can see that you can Mac flush DNS in a few clicks with a tool like CleanMyMac X, or do it manually by carefully putting the right command into Terminal. Plus, improve your SSH experience with Core Shell, get accurate Mac stats with iStat Menus, and keep up-to-date backups with Get Backup Pro.

250+ apps for $9.99
per month

Sign up to Setapp and try them for free.

Security-tested