TechBuzzPro

How to Clear DNS Cache on Mac (macOS)

· 5 min read · Mac

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

To clear the DNS cache on a Mac, open Terminal and run a single command based on your macOS version. This forces your Mac to discard stored DNS lookups and re-query the DNS server, which often fixes website loading errors, outdated IP addresses, or slow browsing. You don't need any special tools, just Terminal access.

What You'll Need

  • Administrator (admin) account on your Mac, or the ability to enter an admin password when prompted.
  • Terminal app, located in Applications > Utilities > Terminal.
  • Your macOS version (Apple menu > About This Mac) to choose the correct command.

Step-by-Step

  1. Open Terminal. Go to Applications > Utilities and double-click Terminal. Alternatively, press Cmd + Space, type “Terminal”, and press Return.
  2. Check your macOS version (optional but helpful). Click the Apple menu in the top-left corner, select About This Mac, and note the version number (e.g., macOS Sonoma 14.5, macOS Ventura 13.6). This determines which command to use.
  3. Run the appropriate command. Copy and paste the exact command for your macOS version into Terminal, then press Return:
  4. For macOS Sonoma (14), Ventura (13), Monterey (12), Big Sur (11), Catalina (10.15), Mojave (10.14), High Sierra (10.13), Sierra (10.12), OS X El Capitan (10.11), Yosemite (10.10), Mavericks (10.9):
    sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
    This flushes the cache and restarts the DNS responder service.
  5. For macOS Big Sur (11) and later, you can also use:
    sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder – this is the same as above; it works on all modern versions.
  6. For older versions (OS X Yosemite 10.10 through macOS Big Sur 11), the command is the same as above. For OS X Lion (10.7) through Mavericks (10.9), use:
    sudo killall -HUP mDNSResponder
    For OS X Mountain Lion (10.8) and earlier, use:
    sudo dscacheutil -flushcache (but these are ancient and rarely used).
  7. Enter your admin password. After running the command, Terminal will prompt for your password. Type your Mac's login password (it won't show as you type) and press Return. The command will execute silently; if successful, you'll return to the command prompt.
  8. Confirm the cache is cleared (optional). You can verify by running sudo dscacheutil -stat to see cache statistics, but this is not necessary. The flush command itself is sufficient.
  9. Restart your browser (or Mac) if needed. Sometimes the browser caches DNS separately. Quit and reopen your browser, or restart your Mac if issues persist.

Common Mistakes

  • Using the wrong command for your macOS version. The most common mistake is using a command meant for older macOS on a newer one, or vice versa. The commands above are accurate for the listed versions, but if you're unsure, use the dscacheutil and killall combination which works on all versions from Yosemite (10.10) onward.
  • Forgetting “sudo”. The commands require administrator privileges. Without sudo, you'll get a “permission denied” error. Always include sudo at the beginning.
  • Typing the command incorrectly. Copy and paste the command to avoid typos. Ensure there's a space after the semicolon and that the command is exactly as shown.
  • Expecting immediate output. The command runs silently. If you see no output, that's normal – it means it worked. Don't assume it failed just because nothing appears.

Tips

  • Clear your browser cache too. DNS cache is separate from browser cache. If you're troubleshooting a website, also clear your browser's cache and cookies (usually in Settings/Preferences > Privacy or History).
  • Use the same command for all modern macOS. From Yosemite (10.10) to Sonoma (14), the command sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder is universally accepted. Stick with that to avoid version confusion.
  • No need to restart your Mac. The flush takes effect immediately. Only restart if you're also troubleshooting other network issues.
  • If you're on a corporate network, check with IT. Some organizations have custom DNS settings that might require additional steps, but the flush command still works.

Troubleshooting

If the command doesn't work or you get an error, try these in order:

  1. Check for typos. Re-copy the command exactly as shown. A missing semicolon or space can cause a “command not found” error.
  2. Ensure you're using sudo. If you see “Permission denied”, you forgot sudo. Add it at the beginning and try again.
  3. Verify your macOS version. If the command fails with “unknown command” (e.g., dscacheutil not found), you might be on an ancient macOS (pre-10.10). Use the older command: sudo killall -HUP mDNSResponder (for Lion through Mavericks) or sudo dscacheutil -flushcache (for even older).
  4. Restart your Mac. If the flush seems to work but issues persist, a full restart clears all network caches and resets network services. This is a safe, simple fix.
  5. Check your DNS server. If clearing the cache doesn't fix the problem, the issue might be with your DNS server itself. Try switching to a public DNS like Google (8.8.8.8) or Cloudflare (1.1.1.1) in System Settings > Network > Wi-Fi > Details > DNS.
  6. If all else fails, reset your network settings. Go to System Settings > General > Transfer or Reset > Reset > Reset Network Settings (macOS Ventura or later). This removes all saved Wi-Fi networks and VPN configurations, so use it as a last resort.

Frequently Asked Questions

How often should I clear the DNS cache on my Mac?

Only when you're experiencing DNS-related issues, such as websites not loading, showing old content, or redirecting incorrectly. There's no need to clear it regularly; the system manages it automatically.

Will clearing the DNS cache speed up my internet?

It can speed up browsing if the cache is corrupted or outdated, but it won't boost your raw internet speed. It forces your Mac to re-query DNS servers, which might resolve slow loading caused by a stale cache.

Is it safe to clear the DNS cache?

Yes, it's completely safe. Your Mac will simply re-fetch DNS information as needed. It doesn't delete any personal files or settings.

Do I need to restart after clearing the DNS cache?

No, a restart is not required. The flush takes effect immediately. However, if you're also having other network issues, a restart can help reset the network stack.

Why do I need to enter my password?

The command requires administrator privileges because it modifies system-level network services. Your password is used only for that command and isn't stored.

Does clearing the DNS cache work on Apple Silicon (M1/M2) Macs?

Yes, the same commands work on all Macs, including those with Apple Silicon. The process is identical.