How to Flush DNS Cache on macOS
How to Flush DNS Cache on macOS
When a website moves to a new server or your home router hands out a bad address, your Mac may keep using an old IP long after DNS has changed. Browsers and apps resolve hostnames through DNS caches — layers that remember answers to avoid asking the network every time.
Flushing (or resetting) those caches forces macOS to look up names again, which often fixes “site works on my phone but not on the Mac,” stuck development domains, or changes right after editing /etc/hosts.
This guide explains what is being cleared, how to do it manually in Terminal, and how NythyCleaner runs the same steps from Maintenance → Flush DNS.
What you are actually clearing
On macOS, “DNS cache” usually refers to two related pieces:
- Directory Service cache — the system’s resolver cache, traditionally flushed with
dscacheutil -flushcache. - mDNSResponder — Apple’s daemon that handles much of DNS and multicast DNS; sending it
HUPmakes it reload its state so lookups are refreshed.
Apple’s internals evolve with each macOS release; on some versions one command prints a note that another layer handles caching. In practice, running both steps (as NythyCleaner does) remains the standard troubleshooting sequence for desktop Macs.
Note: This is not the same as clearing a browser’s internal DNS or HTTPS cache. If only one browser misbehaves, try a hard refresh or private window; if every app shows the wrong address, flush the system cache.
Method 1: Terminal (manual)
Open Terminal (/Applications/Utilities/Terminal.app).
Run:
dscacheutil -flushcache
sudo killall -HUP mDNSResponder
- The first line clears the Directory Service DNS cache (may not prompt for a password).
- The second typically requires administrator password because it signals a system daemon. If you prefer not to use
sudo, your user may still rundscacheutil;mDNSResponderis what most guides emphasize for a full reset.
On some setups, killall exits with a non-zero code if the process name differs; that is harmless if DNS already refreshed.
Alternative (all-in-one with sudo):
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
After flushing, try ping example.com or open the site again.
Method 2: NythyCleaner Maintenance
NythyCleaner includes a guided Maintenance section with one-click tasks. The Flush DNS task runs the same sequence the app uses for maintenance automation:
/usr/bin/dscacheutil -flushcache/usr/bin/killall -HUP mDNSResponder(failure ignored if the signal is unnecessary on your macOS build)
That matches the implementation in the app’s maintenance task runner: flush the directory cache, then hang up mDNSResponder so resolver state is rebuilt.
Why use the app instead of Terminal?
- You do not have to remember paths or argument order.
- It sits next to other maintenance actions (Spotlight, LaunchServices, icon caches, etc.) if you are already tuning the system.
- The task is explicit — you confirm before running, consistent with other maintenance operations.
If macOS shows a privilege prompt for any step that requires admin rights in your configuration, approve it so the daemon can receive HUP.
When flushing helps
- After changing DNS servers (router, VPN, Cloudflare, etc.).
- When a site moved but your Mac still resolves the old IP.
- After editing
/etc/hostsfor local development. - When network troubleshooting and you have ruled out Wi-Fi but names still resolve incorrectly.
When flushing does not help
- Pure connectivity issues (no route to the internet).
- Server-side or CDN problems — the new IP may still be wrong upstream.
- Captive portals or VPN split tunnel misconfiguration.
- Browser-only issues — try another browser or disable extensions.
Frequently asked questions
Is it safe?
Yes for normal troubleshooting. You are not deleting personal files — only forcing fresh DNS lookups.
How often should I do it?
Only when needed. Constant flushing adds unnecessary resolver load.
Does it clear DoH / encrypted DNS in the browser?
Browsers that use their own encrypted DNS path may still cache separately; flush the system cache first, then test in a private window.
Will NythyCleaner replace my DNS servers?
No. It only clears caches and signals mDNSResponder, it does not change your network settings.
Conclusion
Flushing DNS on macOS means clearing resolver caches and restarting the DNS responder’s state, usually with dscacheutil -flushcache and killall -HUP mDNSResponder. You can run those in Terminal with sudo where required, or use NythyCleaner Maintenance → Flush DNS to execute the same steps in one guided action — ideal when you are already maintaining the rest of your Mac in the same place.