macOS DNS Cache: How mDNSResponder Works & How to Flush It
Why the "correct" macOS flush command you find online might be outdated, and what actually works on current releases.
Search "flush DNS Mac" and you'll find several different commands across different forum posts and years — a direct result of Apple having changed the underlying DNS caching architecture more than once across macOS's history. This guide explains why, and gives the command that's correct for current releases.
sudo dscacheutil -flushcache followed immediately by sudo killall -HUP mDNSResponder — since the second command ensures mDNSResponder itself restarts cleanly rather than just clearing the directory service cache alone.- Introduction
- What Is mDNSResponder?
- The Current Correct Flush Command
- Why the Command Has Changed Over Time
- mDNSResponder & Bonjour
- Verifying the Flush Worked
- Terminal Basics for This Task
- Network Locations & DNS
- Interaction With VPN Clients
- Comparison Tables
- Enterprise Mac Fleet Considerations
- Common Mistakes
- Command Reference Checklist
- Expert Tips
- Daily Practical Use Cases
- Glossary
- FAQ
📝 Introduction
macOS handles DNS caching through a dedicated background process rather than exposing it through a simple, stable command-line flag the way some other operating systems do — and that process's exact behavior, and the command needed to interact with it, has genuinely changed across major macOS releases, which is the direct cause of the conflicting advice you'll find searching online.
⚙️ What Is mDNSResponder?
mDNSResponder is the macOS background daemon responsible for DNS resolution and caching, and it also handles multicast DNS — the protocol behind Bonjour, Apple's zero-configuration local network device discovery system. This dual role is specific to macOS's networking architecture and explains why the same process appears in discussions of both DNS troubleshooting and local network device discovery issues.
🗑️ The Current Correct Flush Command
On current macOS releases, the standard, working approach combines two commands run in sequence in Terminal: sudo dscacheutil -flushcache, which clears the directory service cache, followed by sudo killall -HUP mDNSResponder, which sends a restart signal to the responder process itself. Both require your administrator password via sudo, and running both together — rather than just one — is what reliably produces a full, clean cache flush on modern macOS.
🔄 Why the Command Has Changed Over Time
Apple has restructured the underlying DNS caching and directory services architecture across major macOS version transitions more than once, each time altering exactly which command or combination of commands actually clears the cache. This is precisely why older how-to articles referencing a single standalone command, without the accompanying killall step, may no longer work reliably on current releases — the architecture they were written against has since changed.
📡 mDNSResponder & Bonjour
Because mDNSResponder handles both standard DNS caching and Bonjour's local device discovery, restarting it via the flush command can briefly interrupt in-progress local network discovery — such as AirPlay device detection or network printer discovery — for a moment immediately after the flush, which is normal and resolves itself automatically within seconds.
✅ Verifying the Flush Worked
Unlike Windows' displaydns command, macOS doesn't offer as convenient a built-in way to directly inspect current cache contents before and after a flush — the most practical verification is simply re-running a lookup for a domain you know recently changed and confirming it now returns the updated, current result.
🖥️ Terminal Basics for This Task
Both flush commands need to be run in the Terminal application, found in Applications > Utilities, or launched quickly via Spotlight search. Type or paste each command, press Return, and enter your administrator password when prompted for sudo — the password won't be visible as you type, which is expected standard terminal behavior rather than an error.
🌐 Network Locations & DNS
macOS supports multiple named "Network Locations," each with its own independent network configuration including DNS settings, and a flush affects the currently active location's cached data — worth being aware of if you regularly switch between configured locations, such as separate home and office setups, since a flush needs to happen while the relevant location is actually active.
📡 Interaction With VPN Clients
A DNS cache flush on macOS can be a useful step immediately after connecting or disconnecting a VPN, since it clears any pre-VPN cached entries that might otherwise continue serving stale results during the transition — see our VPN DNS Leak guide for broader VPN-specific DNS considerations beyond just caching.
📊 Comparison Tables
| Command | Purpose |
|---|---|
| sudo dscacheutil -flushcache | Clears the directory service cache |
| sudo killall -HUP mDNSResponder | Restarts mDNSResponder cleanly |
🏢 Enterprise Mac Fleet Considerations
IT teams managing a fleet of Mac devices across mixed macOS versions should maintain documentation of the correct flush command for each supported version separately, since a single organization-wide instruction sheet assuming one universal command can quietly fail for users on older or newer releases than the one it was written for.
❌ Common Mistakes
✅ Command Reference Checklist
- Open Terminal from Applications > Utilities
- Run sudo dscacheutil -flushcache
- Run sudo killall -HUP mDNSResponder
- Re-test the domain in question to confirm the change is visible
🎓 Expert Tips
💼 Daily Practical Use Cases
Developers on Mac use this flush routinely after deploying DNS changes to their own projects. Support engineers reference the current correct command when helping Mac users troubleshoot connectivity issues. IT teams managing Mac fleets keep this reference on hand for onboarding and troubleshooting documentation across mixed macOS versions.
📚 Glossary
| Term | Definition |
|---|---|
| mDNSResponder | The macOS process handling DNS caching and Bonjour local discovery |
| dscacheutil | A macOS command-line utility for interacting with directory service caches |
ToolsNovaHub tools are built and independently maintained with a focus on accurate, no-signup network and security utilities. Spotted an error? Let us know.
📋 Related Tools & Guides Comparison
| Resource | Type | Link |
|---|---|---|
| DNS Cache Checker | Tool | Open Tool → |
| Browser DNS Cache | Guide | Read Guide → |
| Windows DNS Cache | Guide | Read Guide → |
| Linux DNS Cache | Guide | Read Guide → |
| Flush DNS Commands | Guide | Read Guide → |