Skip to main content
Error Code Decoders & Troubleshooting

sudo killall -HUP mDNSResponder: Clear DNS Cache on Mac

delete dns cache mac refers to clearing the local DNS resolver cache on macOS using Terminal commands dscacheutil and killall to force fresh DNS lookups.

sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder

This two‑command sequence flushes both the Directory Services cache and the mDNSResponder daemon cache. Run it when DNS changes (hosting migration, record updates) do not reflect after propagation.

When to flush the DNS cache

Stale cache causes site unreachable errors, outdated content, or misdirected traffic. Typical triggers:

  • After changing a domain’s A/AAAA records
  • After switching hosting providers
  • After reconnecting a VPN that changes nameservers
  • When a site that worked earlier now shows “server not found”

How to flush DNS cache on any modern macOS

  1. Open Terminal from Applications → Utilities.
  2. Execute the following command and enter your admin password when prompted:
    sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder

    No output signals success.

  3. Optional: verify with dig example.com +short to confirm the old IP is gone.

Common errors

  • “Operation not permitted” – Ensure you use sudo and have admin privileges. Run sudo -v to refresh credentials.
  • “No matching processes” – mDNSResponder is not running. Restart it: sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.mDNSResponder.plist.
  • “dscacheutil: invalid option” – The -flushcache flag requires macOS 10.7+. On older systems (10.5/10.6) use sudo lookupd -flushcache.
  • Password not accepted – Verify your password or check sudoers restrictions.
  • Still seeing old IP after flush – The TTL may not have expired globally, or a secondary cache (browser, router) persists. Clear browser cache and check DNS propagation.
  • System feels slower after flush – Temporary; performance returns as new entries populate.

Version history

The sudo killall -HUP mDNSResponder command works on macOS 10.9 and later. On macOS 10.10 and earlier, some guides mention sudo discoveryutil mdnsflushcache, but that is deprecated. The command above is universal for modern releases (macOS 10.11+, including macOS Ventura, Sonoma, Sequoia).

Frequently Asked Questions

What is the difference between dscacheutil -flushcache and sudo killall -HUP mDNSResponder?

Answer: Both flush the DNS cache; dscacheutil -flushcache clears system cache entries, while killall -HUP sends a hangup signal to mDNSResponder, forcing it to reload its configuration and clear its cache. For complete clearance, run both consecutively.

sudo dscacheutil -flushcache && sudo killall -HUP mDNSResponder

When should I use sudo killall -HUP mDNSResponder over dscacheutil -flushcache?

Answer: Use sudo killall -HUP mDNSResponder when standard flush fails, DNS resolution issues persist after dscacheutil -flushcache, or after VPN reconnect or interface changes. The signal forces a daemon restart, clearing entries that dscacheutil might miss.

sudo killall -HUP mDNSResponder

How do I fix “Permission denied” when running dscacheutil -flushcache on macOS?

Answer: Prepend sudo to gain root privileges: sudo dscacheutil -flushcache.

sudo dscacheutil -flushcache

Does dscacheutil -flushcache work on macOS Sonoma (14.x) and Sequoia (15.x)?

Answer: Yes, dscacheutil -flushcache works on all modern macOS versions including Sonoma and Sequoia. Apple consistently supports it. For older versions (10.9–10.11), sudo killall -HUP mDNSResponder remains the primary fallback.

# macOS 10.12+ (including Sonoma, Sequoia)
sudo dscacheutil -flushcache
sudo killall -HUP mDNSResponder

What is the fastest way to delete DNS cache on macOS from the command line?

Answer: Execute sudo dscacheutil -flushcache && sudo killall -HUP mDNSResponder in one line. This guarantees a full flush without waiting.

sudo dscacheutil -flushcache && sudo killall -HUP mDNSResponder

See also  Clear SSL Cache: Troubleshooting for Windows, macOS, Browsers