Generally, flushing out DNS on a Mac is unnecessary, but in many cases, it can help to solve some Internet connection problems on your computer. In this article, you will learn how to clear the DNS cache on Mac.
This guide is based on the macOS Support Essentials course and is written by Apple Certified Support Professionals from Nektony’s team. We know everything about macOS systems and are happy to help you keep your Mac running fast and clean from unwanted files.
- What is a DNS?
- What is a DNS cache and should you clear it?
- How often you should flush the DNS cache on Mac.
- How to clear the old DNS cache.
- How to clear browser cache on Mac.
Download MacCleaner Pro with a 7-day free trial and clean up the cache on your Mac.
What is a DNS?
DNS (Domain Name System) is a distributed system for storing information about domains and providing it at the users’ request. It is also used for caching DNS records of other servers. The DNS links the IP address of the host, which contains the necessary data, and the domain itself.
On average, updating DNS records takes 4 to 24 hours, because the data stored on DNS servers around the world cannot be updated immediately. It is usually updated once a day. This process is automated and independent of hosting providers.
What is a DNS cache and should you clear it?
DNS Cache is a database that contains temporary records of all recent visits and attempts to visit websites and other IP addresses of websites. While DNS records are stored on hub Internet servers, the DNS cache is stored locally on your computer.
DNS cache is needed to make pages load faster when you visit them again. It allows the network equipment to interact with websites without a need to remember the IP address of each website. The information can be cached both locally and on the used DNS-Server (for example, Cloudflare / Google).
In short, DNS caching provides quick access to any domain and reduces the load time on the DNS server by reducing the number of accesses to it. The DNS information is not saved every session. The DNS cache is saved only when you visit a particular website the first time.
If you have problems with displaying sites or loading them, the problem is most likely due to outdated DNS cache data on your computer. For example, your computer’s local cache contains old data or your ISP’s DNS server cache contains old content. In this case, you should clear the DNS cache, which will help to update DNS information and resolve the issues.
Also, if a website that has moved to a new hosting fails to load, or a substitute page is opened instead of the required page (which is caused by malicious software interfering with the DNS service), clearing the global DNS cache might help. And, finally, flushing a DNS is often necessary after changing the settings of the DNS gateway (modem, router).
How often you should flush the DNS cache on Mac
“Flushing” the DNS cache means clearing the database of websites’ IP addresses the user visited. It is safe to flush the DNS cache. However, there is no need to refresh DNS without a reason for this.
You should flush DNS in the following cases:
- When the DNS settings have been changed and the page does not load.
- When you need to remove a specific server or domain cached data.
- When you encounter any other issues with displaying websites.
Thus, you can refresh the DNS cache when a DNS change has been made on a website and you need your system to reflect the changes made there. Please note that since the DNS cache is used to load the websites faster, regularly flushing DNS without any reason generally can slow down the Internet speed.
How to clear the old DNS cache
You can clear the DNS cache on Mac using the Terminal command line. Depending on which macOS version you use, you will have to run different commands to refresh the DNS cache.
Here are the commands to clear the local DNS cache on a Mac:
- Launch Terminal from the Applications folder.
In the Terminal’s window, type the command below.
- For macOS High Sierra and later
sudo killall -HUP mDNSResponder
- For macOS El Capitan
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
- For macOS High Sierra and later
- Press Return (Enter).
- Type your admin password and press Return
Note: When entering the password, nothing will be displayed in the Terminal window; this is normal.
- After clearing the DNS cache, the command cursor will move to a new line. It usually takes a few seconds.
If flushing the local DNS cache didn’t help you to resolve the issues, then the problem might be connected with the service itself.
If you are the website owner and you want to make your pages load faster, you can try clearing the Google Flush Cache and Cloudflare Purge Cache. This option is required when any services do not see the changes you made in the local DNS data. Just follow the links, specify the domain name, select the type of DNS record for which you want to delete the DNS cache, and clear the cache. Please note that you should do this only if you are an experienced user and understand what you are doing.
How to clear browser cache on Mac
If, sometimes, your browsers start working slowly, you should clear the browser cache. Each browser has an option to clear cache in its settings. However, it’s much easier and faster to use the software tool MacCleaner Pro from Nektony to clear applications’ cache on Mac. In addition to cache files, MacCleaner Pro also cleans up other types of junk files, like logs, cookies, language files, and duplicate files, and helps to speed up a Mac.
Here is how to clear the browser cache on Mac with MacCleaner Pro:
- Download and launch MacCleaner Pro.
- Go to the Clean Up section and switch to the Expert mode.
- Click on the Caches category.
- Select for which browser you want to clear the cache.
- Click on the Remove button and confirm the action. With MacCleaner Pro, you can also clean up the cache of all other applications on your Mac.
If any website does not load or displays old outdated content, clearing the DNS cache can help to solve the issue. This can be done on Mac with a flush DNS command in Terminal. To effortlessly clear a browser cache on Mac, use the easy tool MacCleaner Pro.