Run sudo dscacheutil -flushcache followed by sudo killall -HUP mDNSResponder when you want the most reliable DNS refresh on macOS. The first command clears the system cache queried by Directory Services, while the second nudges the DNS responder that macOS uses for most name lookups. Apple’s manual for dscacheutil describes -flushcache as a way to flush the entire cache [source: Apple]. In plain English: use both when stale DNS is wasting your time.
TLDR: For modern macOS versions, the safest quick fix is to run both dscacheutil and killall -HUP mDNSResponder. If a website moved from 203.0.113.10 to 203.0.113.25 and the DNS TTL is 300 seconds, flushing can spare you a five-minute wait. In a small help desk handling 40 DNS-related tickets a week, even a 25% reduction in repeat checks saves real time. No output after the commands is normal, annoyingly enough.
The quick command set
Open Terminal and run:
sudo dscacheutil -flushcache
sudo killall -HUP mDNSResponder
You may be asked for your admin password. Type it and press Return. The password will not appear on screen. That blank response feels broken the first time, but it is normal Unix behavior.
If you are troubleshooting a browser issue, quit and reopen the browser after running the commands. Browsers, VPN clients, proxies, and developer tools can keep their own DNS or connection state. It drives me crazy that clearing the macOS cache can be the right move and still not fix a tab that has been open for hours.
What dscacheutil -flushcache does
dscacheutil is a macOS utility for querying and managing caches used by Directory Services. Those caches can include host lookups, users, groups, and other directory-related records.
When you run:
sudo dscacheutil -flushcache
you tell macOS to clear cached directory information. For DNS work, the useful part is that hostname records stored through that system cache can be removed. The next lookup should request fresh data instead of reusing stale entries.
Use dscacheutil when:
- A domain recently changed IP addresses.
- A local hostname resolves to an old address.
- You changed DNS servers in System Settings.
- You edited
/etc/hostsand macOS seems stubborn. - Corporate DNS or VPN resolution is acting weird.
The command is safe. It does not delete files. It does not reset your network settings. It only clears cached lookup data, so macOS must fetch fresh answers again.
What killall -HUP mDNSResponder does
mDNSResponder is the macOS service that handles a large chunk of name resolution. Despite the name, it is not only for multicast DNS. It is involved in regular DNS lookups, Bonjour names, local network discovery, and related resolver behavior.
The command looks scary:
sudo killall -HUP mDNSResponder
But in this case, killall sends a HUP signal to mDNSResponder. It does not mean “delete DNS forever.” The service receives the signal and refreshes its state. On recent macOS releases, this is the command many admins reach for first when DNS answers are stuck.
Use killall -HUP mDNSResponder when:
pingresolves the wrong IP address.- Safari or Chrome keeps loading the old server.
- Bonjour names such as
printer.localbehave badly. - A VPN split DNS setup has just connected or disconnected.
- You changed Wi Fi networks and local names are stale.
So which one should you use?
Use both. That is the least dramatic answer, but it is also the one that saves the most time.
| Command | Main role | Best for |
|---|---|---|
dscacheutil -flushcache |
Clears Directory Services cache | Cached host records, directory lookups, general stale cache |
killall -HUP mDNSResponder |
Signals the DNS responder service | DNS refresh, Bonjour, local names, resolver behavior |
On older macOS versions, DNS internals changed a few times. That history is why you will find five different command recipes in old forum threads. For most current machines, especially macOS Catalina, Big Sur, Monterey, Ventura, Sonoma, and newer, the two-command method is the practical choice.
How to check whether the flush worked
After flushing, test from Terminal:
dscacheutil -q host -a name example.com
You can also use:
dig example.com
Be careful with dig. It is useful, but it may not behave exactly like a normal app using the macOS resolver path. If dig shows the new IP and Safari still shows the old site, the browser may be holding onto a connection, cache entry, HTTP redirect, or DNS over HTTPS setting.
For a fuller DNS view, try:
scutil --dns
This shows the resolvers macOS knows about. It is especially helpful with VPNs. Expect to waste time here if you have three network services, a company VPN, and a security agent all trying to be helpful at once.
Common mistakes that make DNS flushing seem useless
- Forgetting the browser cache: A browser may keep using an open connection to the old server.
- Ignoring DNS TTL: Other resolvers upstream may still cache the old answer until the TTL expires.
- Testing the wrong DNS server: Your Mac may use different resolvers on Wi Fi, Ethernet, and VPN.
- Blaming DNS for HTTP redirects: A site can resolve correctly and still redirect to the wrong place.
- Overlooking
/etc/hosts: A manual hosts entry can override DNS and cause fake “cache” problems.
If you edited /etc/hosts, flush DNS after saving the file. Then test with dscacheutil -q host -a name yourdomain.test. If the result still looks wrong, check the file for spacing errors, duplicate entries, or hidden characters.
When flushing DNS actually helps
DNS flushing is useful after server migrations, CDN changes, staging site swaps, VPN changes, router replacements, and local development edits. It is also handy when a Mac keeps visiting an old IP while another device on the same network sees the new one.
Here is a realistic case. A developer points app.company.test from a staging server to a local machine. The DNS record changes, but macOS keeps loading the staging app. Running both flush commands takes about 10 seconds. Restarting the browser takes another 5. That beats poking through settings for 15 minutes while muttering at a perfectly innocent router.
Best practice for admins and power users
Create a small shell alias if you flush DNS often:
alias flushdns='sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder'
Add it to your shell profile, such as ~/.zshrc, then run:
flushdns
This keeps the process consistent. It also reduces typos in mDNSResponder, which is exactly the kind of service name nobody wants to type twice.
The practical answer
dscacheutil clears one cache layer. killall -HUP mDNSResponder refreshes the responder handling DNS behavior. They overlap, but they are not identical. If you are fixing stale DNS on macOS, run both, restart the affected app, and then test with a fresh lookup.
That simple routine solves most local DNS cache problems without rebooting the Mac. Save the reboot for the truly cursed cases.

