How to Clear DNS Cache on Mac OS X
In this article
Clearing the DNS cache on a Mac can resolve issues like websites not loading, showing old IP addresses, or returning 'Server Not Found' errors. It forces your Mac to flush stored DNS records and query fresh ones from your DNS server. This guide covers the exact commands for different macOS versions, plus troubleshooting tips if the standard commands fail.
What You'll Need
- Administrator (admin) user account on your Mac
- Access to the Terminal app (found in /Applications/Utilities/)
- Your macOS version (Apple menu → About This Mac)
Step-by-Step
- Open Terminal – Go to Finder → Applications → Utilities → Terminal. Alternatively, press Cmd + Space, type “Terminal”, and hit Enter.
- Identify your macOS version – Click the Apple logo in the top-left corner and select “About This Mac.” Note the version number (e.g., macOS Sonoma 14.5, Ventura 13.6, Monterey 12.7, etc.).
- Run the appropriate command – Copy and paste the command for your version into Terminal, then press Enter:
- macOS Ventura (13) and later (including Sonoma 14, Sequoia 15):
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder - macOS Monterey (12) and Big Sur (11):
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder(same as above, but works on these versions too) - macOS Catalina (10.15) and Mojave (10.14):
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder(also works, but you can use justsudo killall -HUP mDNSResponderif you prefer) - macOS High Sierra (10.13) and earlier (Sierra, El Capitan, Yosemite):
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder– this works for 10.13 and 10.12. For OS X 10.10–10.11, usesudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder(yes, same command). - OS X Mavericks (10.9) and older:
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder– for 10.9 and 10.8, this is the standard. For 10.7 and earlier, usesudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder(but note that 10.6 and older usedlookupd– see Troubleshooting).
- macOS Ventura (13) and later (including Sonoma 14, Sequoia 15):
- Enter your password – When prompted for a password, type your admin password (characters won’t appear as you type – that’s normal) and press Enter.
- Confirm success – The command will run silently and return to the prompt. There’s no “success” message. To verify, you can run
dscacheutil -cachedump -entries Host– if it returns “No cache entries” or similar, the cache is cleared.
Common Mistakes
- Using the wrong command for your macOS version – Older commands like
lookupd -flushcachewill fail on modern macOS. Always check your version first. - Forgetting
sudo– The commands require admin privileges. Withoutsudo, you’ll get a “permission denied” error. - Typing the password but not seeing it – Terminal doesn’t show asterisks or dots. Just type and press Enter.
- Using a semicolon instead of a space – The semicolon separates two commands. If you type a space instead, you’ll get a syntax error.
- Quitting Terminal before the command finishes – Wait for the prompt to return before closing.
Tips
- Clear DNS cache after changing DNS servers – If you switch from your ISP’s DNS to Google (8.8.8.8) or Cloudflare (1.1.1.1), flush the cache to avoid old records.
- Use a single command for all modern macOS – The command
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponderworks on macOS 10.10 through 15. So if you’re unsure, use that. - Test with a known domain – After flushing, try loading a website you had trouble with. If it works, the cache was the issue.
- Create a keyboard shortcut or alias – In Terminal’s preferences, you can add a profile shortcut to run the command quickly, but that’s optional.
Troubleshooting
- “command not found” error – This means you’re using an outdated command (like
lookupd). Use the modern command listed above. - “Operation not permitted” – Ensure you’re using
sudoand have admin rights. If you’re not an admin, you’ll need to ask the admin to run it. - Password prompt appears but command fails – Double-check that you’re typing the correct admin password. If you’ve forgotten it, you’ll need to reset it via Apple ID or recovery mode.
- Cache still not cleared after running the command – Some network configurations (like VPNs or custom DNS settings) may cache at a different layer. Try restarting your Mac or turning Wi-Fi off/on.
- On very old macOS (10.6 or earlier) – Use
sudo dscacheutil -flushcache(without the killall) orsudo lookupd -flushcache. If that fails, try restarting. - If you get a “DNS cache flush failed” message – This is rare on modern macOS. Try running the command again after a few seconds, or restart your Mac and try again.
Frequently Asked Questions
Will clearing DNS cache speed up my internet?
Not necessarily. It can speed up access to websites that changed IP addresses, but it doesn’t increase raw bandwidth or latency. It’s a troubleshooting step, not a performance booster.
Is it safe to clear DNS cache?
Yes. It’s a standard maintenance task. Your Mac will simply re-query DNS servers the next time you visit a website, which adds a few milliseconds to the first load.
How often should I clear DNS cache?
Only when you encounter DNS-related issues like “Server Not Found” or when you’ve changed DNS servers. There’s no need to do it regularly.
Does clearing DNS cache log me out of websites?
No. DNS cache is unrelated to your login sessions or cookies. You’ll stay logged in.
What if I’m using a VPN? Does the command still work?
Yes, the command flushes the local DNS cache. However, the VPN’s own DNS settings may still cache records, so you might need to reconnect the VPN or flush its cache separately.
Can I clear DNS cache without using Terminal?
There’s no built-in GUI option. Third-party apps can do it, but Terminal is the official and safest method.