How to Clear DNS Cache in macOS Sonoma

Facing issues with your macOS DNS settings? Learn the step-by-step guide to flush and reset the DNS cache on macOS Sonoma and older versions.

If you’re a macOS user who has recently modified your DNS settings, it might be a good idea to flush, or in other words, clear the DNS cache. But why is clearing the DNS cache important?

It’s essential because when your DNS is cached, the nameservers or domain name might not resolve to the correct IP. This can direct you to a cached version of a website or, even worse, prevent you from establishing a connection to the desired website.

How to Clear My Mac’s DNS Cache?

In this article, I’ll guide you on how to clear and reset the DNS cache on the latest macOS Sonoma (Version 14.0).

For those using macOS Ventura or earlier versions, refer to the commands to clear the cache here.

Step 1.

Open the Terminal app. You can quickly do this by using the keyboard shortcut Command + Space. Then, type “Terminal” and press Enter.

Related: More Terminal shortcut keys.

Screenshot of opening terminal on Mac
Step 2.

Copy and paste the following command into the Terminal, then press Return.

sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder


Screenshot of entering command in terminal
Step 3.

Input your macOS password and press Return once more.


Screenshot of entering password in terminal
Step 4.

Close the Terminal using the keyboard shortcut: Command + Q.

That’s it! Your DNS cache should now be refreshed and cleared.

Clearing DNS Cache on Older macOS

If you’re using an older version of macOS, the mDNSResponder process command mentioned earlier may not work. Consult the table below to find the correct command for clearing the DNS cache based on your macOS version.

macOS Version Command
Ventura (Ver. 13) sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
Monterey (Ver. 12) sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
Big Sur (Ver. 11) sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
Catalina (Ver. 10.15) sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
Mojave (Ver. 10.14) sudo killall -HUP mDNSResponder; sleep 2
High Sierra (Ver. 10.13) sudo killall -HUP mDNSResponder; sleep 2
Sierra (Ver. 10.12) sudo killall -HUP mDNSResponder
El Capitan (Ver. 10.11) sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
Yosemite (Ver. 10.10) sudo discoveryutil mdnsflushcache;sudo discoveryutil udnsflushcaches
Mavericks (Ver. 10.9) dscacheutil -flushcache; sudo killall -HUP mDNSResponder
Mountain Lion (Ver. 10.8) sudo killall -HUP mDNSResponder
Lion (Ver. 10.7) sudo killall -HUP mDNSResponder
Snow Leopard (Ver. 10.6) sudo dscacheutil -flushcache
Leopard (Ver. 10.5) sudo dscacheutil -flushcache
Tiger (Ver. 10.4) lookupd -flushcache
Frequently Asked Questions:
1. Is it safe to clean up DNS cache?

it is generally safe to clear the DNS cache on a Mac. The DNS cache stores information about previously accessed websites and their corresponding IP addresses, so clearing the cache can help resolve issues with accessing certain websites or if changes have been made to DNS records.

2. Does clearing DNS cache speed up internet?

Clearing the DNS cache on a Mac is generally a good practice to help maintain a healthy system and avoid potential issues with accessing websites. But it may not always result in a significant improvement in internet speed.

3. Will DNS on my Mac updates automatically?

DNS information on your Mac should update automatically as needed. However, in some cases, you may need to clear the DNS cache on your Mac manually to resolve issues with accessing websites. Overall, you shouldn’t need to worry too much about managing DNS information on your Mac, as it should update automatically as needed. But if you do encounter issues with accessing websites, clearing the DNS cache can sometimes help.