How to Clear the DNS Cache on macOS
Last modified: November 14, 2020
If you’re looking to clear your DNS cache, then you can do this. But there are different options for different operating systems. In this article, we look at how you can clear the DNS cache for those using a macOS.
An Introduction into DNS Caching
To begin, you will need to understand what DNS cache is and why you might need to clear it and the first thing to understand is what DNS (Domain Name System) is. Essentially, it is the index of all the websites on the internet with a corresponding IP address. It is like an address directory for all the websites. The caching is the snapshot of something that allows that website page or something to load faster the next time a user tries to access it.
Therefore, the DNS caching is the process of your operating system/browser capturing recently-visited IP addresses and storing them. Therefore, when you access the website again, the browser reloads the pages quicker.
However, there are times when the DNS cache can become corrupted. Or, it can become outdated. If anything like this happens, you will need to clear the DNS cache. This can help you get online quickly.
How to Clear DNS Cache on macOS
To clear the DNS cache on a Mac, you will need to use the native command-line interface, known as Terminal. Then you can enter in the right command to complete the process. This process is different, depending on what version of macOS you’re using.
If you’re not certain about the version of macOS you’re working with, then you can check by clicking on the ‘apple’ icon that is located in the top-left corner of the desktop. Then select the option ‘About This Mac’.
The version of macOS that you’re using is the first line of information listed.
Once you know the information, you can find the relevant steps below.
Step 1 – Open Utilities
The first step is to open the command line interface. This is done by going to ‘Go’ and then ‘Utilities’. Then you need to select ‘Terminal’.
Step 2 – Enter in Command
Now you need to enter in the command for caching the DNS. For different versions of MacOS, this is different. So, here is a quick list of the version of mac and what the code is.
macOS El Capitan (10.11), Sierra (10.12), High Sierra (10.13), Mojave (10.14), and Catalina (10.15): sudo killall -HUP mDNSResponder.
MacOS Yosemite (10.10): sudo discoveryutil udnsflushcaches
macOS Lion (10.7), Mountain Lion (10.8), and Mavericks (10.9): sudo killall -HUP mDNSResponder
macOS Snow Leopard (10.6): sudo dscacheutil -flushcache
macOS Leopard (10.5): sudo lookupd -flushcache
After this is done, you will need to enter in your computer password.
Once you’ve done this, you can now try to see if the error has been fixed.
Final Word: How to Clear the DNS Cache on macOS
If you need to clear the DNS cache on your macOS, then you need to look at the above steps. Doing the clear is very easy. However, it does depend on what version you’re using.
A Savvy WordPress developer, years of experience developing for web (PHP, JS, jQuery, Vue, MySQL, etc.), SEO specialist, and more…