How to Flush DNS Cache on macOS and Mac OS X?
Probably you have heard about clearing (flush) DNS cache and its advantages. So, here are going to flush (clear) DNS cache on macOS. You can use the methods on all macOS. This is going to be quick, simple, and easy; but first some words about DNS cache.
DNS (Domain Name System) is used to connect with servers online. Whenever you insert the web address in the browser, that URL is used to find and connect with the database of IP addresses.
Storing cache files is a standard and best way to connect to the website next time. These cache files will store all the necessary data needed and you will get a smoother and faster web on the next visit. You can know more about this here.
Why should you flush DNS Cache on macOS?
Is it good to flush DNS caches? Well, of course, it is a good practice to flush DNS caches on macOS. It is a double-edged sword, where you will find the ease of access and faster loading time, you will also find:
- The accessed website weird. Normally within 24-48 hours, you will find any website changed. Either they have uploaded new contents or tried something new which makes the old data outdated. It will make the sites images to misbehave due to old data.
- You will probably experience server problems. Any server will be declined you will experience the “DNS Server not responding” error on your screen.
- Cache files can be a way for threats as malware to infect your system.
- Not only infecting but you can also be exposed to hackers. Hackers can interact with your system using caches. Using it, they can change or track your IP addresses, manipulate or steal your personal and sensitive data.
- On web browsers, you will find connectivity issues. Having cache files, you will probably experience the 404 (cannot find server) error code.
How to Flush DNS Cache on macOS?
To flush DNS cache on macOS, you are going to use the method below:
You will open Spotlight on your Mac and there you will open Terminal. For Terminal, you are going to type “terminal” in Spotlight. There is also the option to use Command+Space to open Spotlight.
If you can’t find the Terminal in Spotlight then you can go to Go > Utilities > Terminal or click Applications, open the Utilities folder, and then double-click on Terminal.
Flush DNS Cache on macOS
Here you are going to use the following commands inside the Terminal to flush DNS. Since the commands are different on macOS and earlier versions, then you will need to make sure about your system details. In the Apple menu, you will click on Apple Logo > About this Mac.
You can use the command below in the terminal to Flush DNS on macOS. The commands are only applicable on macOS Sierra, macOS High Sierra, macOS Mojave, macOS Catalina, macOS Big Sur, and macOS Monterey.
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
Users who are using Mac OS X or OS X will need to use the specific commands:
Flush DNS on earlier versions of macOS
Here are the commands that are used to flush the cache. I have provided the command for each macOS (from Mac OS X to OS X to macOS). Try to use them and clear the DNS caches.
macOS El Capitan:
sudo killall -HUP mDNSResponder
sudo discoveryutil udnsflushcaches
OS X Lion, OS X Mountain Lion, OS X Mavericks:
sudo killall -HUP mDNSResponder
Mac OS X Snow Leopard:
sudo dscacheutil –flushcache
Mac OS X Leopard:
sudo lookupd –flushcache lookupd –flushcache
Mac OS X Tiger:
How to clear cache on Safari?
There is no harm in clearing cache on Safari. You are going to use this method to clear caches on Safari. For the purpose, you are going to Safari > Preferences > Advanced > Show Develop in the menu bar. Here you are going to enable Develop option by checking the box beside.
Once, you have enabled the option, you will find the Develop option in the menu. There you are going to select the Empty Cache option and your caches will be cleared.
Third party to clear DNS Cache on macOS
There are numerous third-party applications that are used for this purpose. You can easily find them on the internet. By downloading and installing them, not only you will clear caches, but will also remove things like malware, spyware, and temporary files too.
Both free and professional versions are there for the users. I haven’t named any application, as it will be a promotion for them. For users who are confused about which of them should be used, they can use this link and know about them. Here they have explained in detail, which of them are good and why they are good.
Should I often flush the cache file on my macOS?
It is recommended to flush the cache files on your macOS time after time. Good practice for flushing caches is between 1 month to 1.5 months. We have mentioned before, why should you flush the cache and what could probably happen to your system.
How to Check DNS Cache on my macOS?
To check your DNS cache, you will need to open the Console app on your macOS. Then you will open the Mac and there you will use the command “any:mdnsresponde”. This will help you to find all the DNS caches and will display them on your screen.
How to check DNS cache on Safari Browser?
For users who are interested in checking DNS cache on Safari browser, they are going to open their Safari and will paste “chrome://net-internals/#dns” in the URL of their browser. Soon a new window will appear, here you will find all the details related to DNS.