You may occasionally need to remove the DNS cache on your Mac after changing the host’s file or troubleshooting a problem. Even though it requires using the command line, clearing DNS on Mac is often considered an expert’s task. However, after reading this article, all Mac users should find the process rather simple.
- How to clear DNS cache in macOS Ventura and Monterey
- What is a DNS cache?
- Why should you clear DNS cache on Mac?
How to clear DNS cache in macOS Ventura and Monterey
- Launch Spotlight (command + spacebar) → type and choose Terminal.
- Paste the command below in the terminal.
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
- Press the return key.
- Enter your password.
- Hit return.
The password will not be seen in the terminal for security reasons.
Even though nothing will appear on the command prompt screen, your DNS cache will be flushed as soon as you press the return key.
What is a DNS cache?
Let’s first check what DNS is before moving forward to the DNS cache. To put it simply, DNS (Domain Name System) converts human-readable domain names like www.igeeksblog.com to computer-readable IP addresses like 18.104.22.168.
A DNS cache is temporary storage on a computer, smartphone, server, etc., that holds DNS records of previously visited domain names, such as a record for IPv4 addresses, AAAA records for IPv6, etc. It is often referred to as the DNS resolver cache.
Depending on the time-to-live (TTL), DNS keeps records of a website and its addresses which are stored in this fictitious database of information. In essence, the DNS cache is how your device tries to save time and effort by responding to a DNS query with a DNS record already present in the temporary DNS cache, rather than having to perform a lengthy DNS lookup.
Why should you clear DNS cache on Mac?
- The bigger the collection of cached addresses, the more you are revealing about yourself to the online world. Hence, it needs to be cleared.
- Hackers may be able to access your entries and drive you to bogus websites if they have access to the DNS cache.
- Technical issues can be resolved by doing a DNS flush. For example, when the erroneous version of the searched website is shown as a result of out-of-date entries. The connection to the web project is established after a flush, and the appropriate DNS server responds to the request again.
Clear DNS just for the Google Chrome browser. Open Chrome → enter chrome://net-internals/#dns in Chrome’s address bar → click Clear host cache.
You can clear the safari cache easily by following the steps in our article about clearing the Safari cache, history, and cookies on Mac.
Is it safe to clear DNS cache?
Yes, flushing the DNS cache on your Mac is secure. Although cached data is only temporary storage, clearing the DNS cache too frequently may affect the website load time. Did you succeed in clearing the DNS on your Mac, or did you run into trouble? Comment below, and I’ll try to respond as soon as possible.
- Wi-Fi not working on Mac?
- How to Change DNS on Your iPhone and iPad
- How to fix ‘Network is blocking encrypted DNS traffic’ on iOS
Bhaskar is a member of the iGB family and enjoys experimenting with words and rhythms. He also has a knack for web and app development. If not writing, you may find him on strings or engaging in sports. And by evening, his quotes will be appearing on your Instagram feeds.