sodcalculator

10 Tech How-To

How to Reset & Flush DNS Cache on macOS Sierra

Guide 10-35172 · Updated · Step by step

If you’re seeing stale websites, connection errors, or DNS resolution problems on your Mac running macOS Sierra (10.12), flushing the DNS cache can often fix it. This guide walks you through the exact Terminal commands to clear the system’s DNS cache, forcing your Mac to query fresh DNS servers. No additional tools or downloads are needed—just the built-in Terminal app.

What You’ll Need

  • A Mac running macOS Sierra (10.12)
  • Administrator (admin) account credentials—you’ll need to enter your password
  • Access to the Terminal application (found in /Applications/Utilities/)

Step-by-Step

  1. Open Terminal. Go to Finder → Applications → Utilities → Terminal. Alternatively, press Cmd + Space to open Spotlight, type “Terminal”, and press Return.
  2. Run the flush command. Type or paste the following command exactly, then press Return:
    sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder

    This command first clears the directory service cache (dscacheutil) and then restarts the mDNSResponder process, which handles DNS on macOS.

  3. Enter your password. When prompted for a password, type your admin password (characters won’t appear as you type—this is normal) and press Return.
  4. Wait for the command to finish. The command should complete silently. You’ll see the Terminal prompt return (e.g., yourname:~$). If you see an error like “Operation not permitted” or “command not found”, double-check that you’re running the command exactly as written.
  5. Verify the flush (optional). To confirm the cache has been cleared, you can run sudo dscacheutil -cachedump -entries Host and check that the output is empty or minimal. This step isn’t required but can help confirm the flush worked.
  6. Close Terminal. Once the command completes, you can quit Terminal. Test your internet connection by visiting a website you previously had trouble with.

Common Mistakes

  • Using the wrong command for your macOS version. macOS Sierra (10.12) uses the mDNSResponder command. Earlier versions (like 10.9–10.10) used a different process. If you’re on a newer macOS (Catalina or later), the command is slightly different—but for Sierra, this is correct.
  • Forgetting sudo. The command requires administrative privileges. Without sudo, you’ll get a “permission denied” error.
  • Typing the command with a line break. The two commands are separated by a semicolon (;). If you press Enter after the first part, the second part won’t run. Copy-paste the entire line to avoid this.
  • Not entering your password correctly. When you type your password in Terminal, no asterisks or dots appear—this is a security feature. Just type it and press Return.

Tips

  • Flush after changing DNS servers. If you switch to a new DNS provider (like Google DNS or OpenDNS), flushing ensures your Mac doesn’t keep using cached old IP addresses.
  • Use this after network changes. If you move between networks (home, office, coffee shop), flushing can help clear stale entries that cause slow or failed connections.
  • Combine with a network restart. If flushing doesn’t help, try turning Wi-Fi off and on, or restarting your router.
  • Create a keyboard shortcut (optional). You can create a simple script or use a tool like Alfred to run the command with one click, but the built-in Terminal method is always reliable.

Troubleshooting

Command not found: If you see “command not found”, you may have a typo. Ensure you’ve typed dscacheutil and killall correctly. These are standard macOS commands.

Permission denied: This means you didn’t use sudo or your user isn’t an admin. Log in as an admin user or ask your system administrator to run the command.

Still having DNS issues after flushing: Try these steps in order:

  1. Restart your Mac (fully shut down and power on).
  2. Check your DNS settings in System Preferences → Network → Advanced → DNS. Ensure they’re set to reliable servers (e.g., 8.8.8.8 and 8.8.4.4 for Google DNS).
  3. Reset your router by unplugging it for 30 seconds and plugging it back in.
  4. If the issue persists, try resetting the SMC (System Management Controller) on your Mac—this can resolve deeper network issues, but it’s a more advanced step.

Terminal says “Operation not permitted”: This can happen if your Mac’s security settings restrict certain commands. Make sure you’re not in a restricted user account, and try running the command again after restarting Terminal.

Frequently Asked Questions

How often should I flush the DNS cache?

Only when you experience DNS-related problems, such as websites not loading, incorrect IP addresses being resolved, or after changing DNS settings. There’s no need to flush regularly—the cache is designed to speed up browsing.

Will flushing the DNS cache delete my browsing history or passwords?

No. Flushing DNS only clears the local cache of domain-name-to-IP mappings. It doesn’t affect your browser history, saved passwords, or any other personal data.

Can I flush DNS without using Terminal?

On macOS Sierra, there’s no graphical interface for flushing DNS. Terminal is the standard method. Some third-party apps offer a button to do it, but they essentially run the same command.

What is mDNSResponder?

mDNSResponder is a system process that handles DNS resolution and Bonjour (multicast DNS) on macOS. Restarting it with killall -HUP clears its internal state, which is a key part of the flush.

Does this work on macOS High Sierra or Mojave?

Yes, the same command works on High Sierra (10.13) and Mojave (10.14). For Catalina (10.15) and later, the command is slightly different: sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder still works, but you may also need to add sudo killall -HUP mDNSResponderHelper on some versions. For Sierra, the original command is correct.

Why do I need to enter my password?

The command modifies system-level processes, which requires administrator privileges. The password prompt is a security measure to prevent unauthorized changes.

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 →