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, slow browsing, or seeing outdated IP addresses after a server move. This guide walks you through the exact commands for different macOS versions, from older OS X to the latest macOS releases.
What You'll Need
- Administrator (admin) account access on the Mac
- Terminal app (found in /Applications/Utilities/)
- Knowing the macOS version you're running (Apple menu > About This Mac)
Step-by-Step
- Open Terminal – Go to Finder > Applications > Utilities > Terminal, or press Cmd + Space, type “Terminal”, and hit Return.
- Identify your macOS version – Click the Apple logo in the top-left corner, select “About This Mac”, and note the version number (e.g., macOS Sonoma 14.5, Ventura 13, Monterey 12, Big Sur 11, Catalina 10.15, etc.).
- Run the correct command – Based on your version, type one of the following commands and 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 - macOS Catalina (10.15) and Mojave (10.14):
sudo killall -HUP mDNSResponder - macOS High Sierra (10.13) and earlier (OS X El Capitan 10.11, Yosemite 10.10):
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder - OS X Mavericks (10.9) and earlier:
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder(Note: on very old systems like 10.6–10.8, usesudo dscacheutil -flushcacheonly)
- macOS Ventura (13) and later (including Sonoma 14, Sequoia 15):
- Enter your admin password – When prompted, type your login password (it won't show characters as you type) and press Enter.
- Wait for the command to finish – The command should return to the prompt without any error message. If you see “Operation not permitted”, you may need to grant Terminal Full Disk Access in System Settings (or System Preferences) > Privacy & Security.
- Verify the cache is flushed – You can check by running
sudo dscacheutil -cachedump -entries Host– it should show no cached entries, or you can simply try visiting a website that was previously failing.
Common Mistakes
- Using the wrong command for your macOS version – Older commands like
lookupd -flushcache(for OS X 10.4) orkillall -HUP mDNSResponderalone may not work on newer systems. - Forgetting
sudo– Without it, you'll get “permission denied”. Always prefix withsudo. - Typing the password incorrectly – The terminal won't show any feedback; if you mistype, you'll get “Sorry, try again.”
- Copying extra spaces or line breaks – When pasting, ensure no hidden characters are included.
- Running the command from a non-admin account – You must be an admin user to use
sudo.
Tips
- You don't need to restart your Mac after clearing the DNS cache – the effect is immediate.
- If you're troubleshooting a specific website, also try clearing your browser's cache, as it may have its own DNS cache (e.g., Chrome's internal cache).
- Consider using a free tool like Onyx or Cache Cleaner if you're uncomfortable with the command line, but the built-in method is safe and reliable.
- After flushing, you can also reset the DNS resolver by toggling Wi-Fi off/on or restarting your router if issues persist.
Troubleshooting
If the command doesn't work or you see errors, try these steps:
- “Operation not permitted” – Go to System Settings > Privacy & Security > Full Disk Access, add Terminal, and try again.
- “command not found” – This usually means you're on an extremely old macOS (pre-10.4). Use
lookupd -flushcacheinstead. - Password not accepted – Ensure you're using the admin user's password, not an Apple ID password. If you've forgotten it, reset it via Apple ID or Recovery Mode.
- Still seeing old IP addresses – Try flushing again after a few minutes, or check if your router or ISP has its own DNS cache that needs clearing.
- Terminal freezes – Press Ctrl + C to cancel, then restart Terminal and try again.
Frequently Asked Questions
Will clearing DNS cache speed up my internet?
It can, if the cache is corrupted or stale. Otherwise, it has minimal impact on speed.
Do I need to restart my Mac after flushing DNS?
No, the change takes effect immediately.
Is it safe to run these commands?
Yes, they are standard macOS maintenance commands and won't harm your system.
Can I clear DNS cache without using Terminal?
Not directly. You can use third-party apps, but they essentially run the same commands in the background.
Why does the command ask for my password?
Because it modifies system-level settings, requiring administrator privileges.
How often should I clear DNS cache?
Only when you encounter DNS-related issues. There's no need for regular flushing.