sodcalculator

10 Tech How-To

How to Clear DNS Cache on Mac Completely

Guide 10-55189 · Updated · Step by step

If you’re seeing outdated websites, getting connection errors, or your DNS settings have changed, clearing the DNS cache on your Mac can force it to fetch fresh address records. This guide walks you through the exact commands for every recent macOS version, including how to verify the cache is actually empty.

What You’ll Need

  • An administrator account on your Mac (you’ll enter your password for the sudo command).
  • Terminal app — found in Applications > Utilities.
  • Knowledge of your macOS version (click the Apple menu > About This Mac).

Step-by-Step

  1. Open Terminal — Go to Applications > Utilities > Terminal and double-click it. Alternatively, press Cmd + Space, type “Terminal”, and hit Return.
  2. Check your macOS version — Run sw_vers in Terminal. Note the product version (e.g., 14.5 for Sonoma, 13.6 for Ventura). This matters because the command changed with Big Sur.
  3. Clear the cache (macOS Sonoma, Ventura, Monterey, Big Sur — versions 11 and later) — Type exactly this command and press Return:
    sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
    You’ll be prompted for your administrator password. Terminal won’t show characters as you type — that’s normal. Press Return after entering it.
  4. Clear the cache (macOS Catalina and earlier — versions 10.15 and below) — If you’re on Mojave, High Sierra, Sierra, or earlier, use:
    sudo killall -HUP mDNSResponder
    For very old versions (OS X El Capitan through macOS Sierra), also run sudo dscacheutil -flushcache after the killall command.
  5. Verify the cache is cleared — After the command completes (you’ll just see a new prompt line), run:
    sudo dscacheutil -cachedump -entries Host
    If the output shows nothing or only a few entries, the cache is effectively empty. On newer macOS, you can also check with sudo dscacheutil -statistics which should show zero or minimal counts.
  6. Test your connection — Open Safari or your usual browser and visit a site you know has changed recently (like a news site). If it loads correctly, the flush worked. If you still see old content, try a hard refresh with Cmd + Shift + R.

Common Mistakes

  • Typing the command wrong — The most common error is misspelling dscacheutil or mDNSResponder. Copy-paste the command from this guide to avoid typos.
  • Using the wrong command for your macOS version — Running the Big Sur+ command on Catalina will give an error like “unknown option”. Check your version first.
  • Forgetting sudo — Without it, you’ll get “Operation not permitted” or “Permission denied”. The command requires root privileges.
  • Not entering your password correctly — Terminal doesn’t show asterisks while typing your password. If you make a mistake, you’ll see “Sorry, try again.” Just re-run the command.
  • Expecting an instant visual confirmation — The flush command often produces no output on success. That’s normal; don’t assume it failed.

Tips

  • Use a single combined command — The semicolon in sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder runs both parts sequentially. This is the recommended method for modern macOS.
  • Clear browser caches too — DNS cache is separate from browser cache. If pages still look wrong, clear your browser’s cache (Safari: Develop menu > Empty Caches, or Chrome: Settings > Privacy > Clear browsing data).
  • Restart your Mac if it’s still problematic — A full restart clears all system caches and can resolve stubborn DNS issues.
  • Use a free DNS checker — Sites like dnschecker.org let you see if a domain resolves correctly globally, helping you determine if the issue is on your side or the server’s.
  • Create a shortcut — If you clear DNS often, you can create a simple shell script with the command and run it anytime.

Troubleshooting

“sudo: dscacheutil: command not found” — This means you’re on a very old macOS (pre-10.5) or the command is missing. Try the killall command alone. If that fails, restart your Mac.

“killall: killing mDNSResponder failed: No such process” — This indicates the mDNSResponder service isn’t running. It’s rare but can happen after a crash. Restart your Mac to relaunch it, then try again.

“Operation not permitted” even with sudo — This can occur if System Integrity Protection (SIP) is partially disabled or if you’re in a restricted environment. Check with csrutil status in Terminal. If SIP is disabled, re-enable it in Recovery Mode.

Websites still show old IPs after flushing — The DNS cache on your router or your ISP’s server may be stale. Try restarting your router, or temporarily switch to a public DNS like Google (8.8.8.8) or Cloudflare (1.1.1.1) in System Settings > Network > Wi-Fi > Details > DNS.

Terminal says “password incorrect” but you’re sure it’s right — Check that Caps Lock is off. Also, if your keyboard layout is different, the password field may not accept special characters correctly. Reboot and try again.

Frequently Asked Questions

Q: How often should I clear my DNS cache?
A: Only when you experience issues like wrong site versions, connection timeouts, or after changing DNS settings. There’s no need for routine flushing.

Q: Does clearing DNS cache speed up my Mac?
A: No. It can slow down the first few website visits because your Mac has to re-resolve domain names. It’s purely for fixing stale data.

Q: Will this log me out of websites or delete my passwords?
A: No. DNS cache only stores IP addresses. Your cookies, login sessions, and passwords are untouched.

Q: What’s the difference between DNS cache and browser cache?
A: DNS cache stores the IP addresses of domains you’ve visited. Browser cache stores actual page files (images, scripts) to speed up loading. They’re independent.

Q: Can I clear DNS cache without Terminal?
A: Not completely. The system DNS cache requires a command-line command. Some third-party apps provide a GUI, but they run the same commands in the background.

Q: Why does my Mac still have DNS issues after flushing?
A: The problem may be with your router, ISP, or the website itself. Try a different network (like your phone’s hotspot) to isolate the cause.

Related

General steps for current mainstream versions; menus can differ by device and version. See the disclaimer or report an error.

More in this bed

The whole Tech How-To bed →