Sweepfor Mac

Free up storage

How to Clear the DNS Cache on Mac (Terminal Command Plus the Easy Way)

Clear DNS cache on Mac with one Terminal command. Plus what's actually being cleared and why it might fix your connectivity issue.

6 min read

You change your DNS records, your Mac doesn’t notice. You move a website to a new host, your Mac keeps loading the old one. Or you’re troubleshooting a connectivity issue and someone tells you to “flush the DNS cache.” That’s a Terminal command, and it’s been the same one for several macOS versions running.

Here’s the actual command, what it does, and when it’s worth running on macOS Sonoma 14 and Sequoia 15.

The one-line command for Sonoma and Sequoia

Open Terminal and run:

sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder

Enter your admin password when prompted. That’s it.

The first half clears the DNS cache. The second half restarts the multicast DNS responder, which handles Bonjour and local network resolution. Together they fully reset DNS state.

You won’t see any output if it worked. No news is good news.

Tip: macOS doesn't display a DNS cache the way Windows does (with `ipconfig /displaydns`). The cache is internal and not human-readable. Just trust that the flush worked.

What the DNS cache actually is

Every time your Mac visits a website, it asks a DNS server “what’s the IP address for this domain?” and gets back a number. That mapping gets cached locally so the next visit doesn’t have to ask again.

Caches expire based on TTL (time to live) values from the DNS server, but until they do, your Mac uses the cached value. If a domain moves to a new IP and your cache hasn’t expired, you keep loading the old location.

DNS cache also includes:

  • IPv4 and IPv6 lookups
  • Reverse lookups (IP to hostname)
  • Cached “no such domain” responses
  • Local network resolutions via Bonjour/mDNS

When to flush DNS

Common reasons:

  • You can’t reach a website that should be working
  • A site moved hosts and you’re seeing the old version
  • Email isn’t sending or receiving and DNS records changed recently
  • VPN connectivity issues
  • After changing your DNS server in System Settings
  • You added entries to /etc/hosts and they’re not taking effect
  • Troubleshooting “this site can’t be reached” errors

Per-version commands (macOS history)

macOS has used roughly the same command since OS X Yosemite, but small variations exist for older versions. For modern macOS:

  • Sonoma (14): sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
  • Sequoia (15): Same command.
  • Ventura (13): Same command.

If you’re on much older macOS, the command differs. But anything from the last 5 years uses the syntax above.

Doing it via System Settings

There’s no GUI button for “flush DNS” on macOS. You have to use Terminal. Apple has never added a UI option for this — it’s always been a power-user feature.

The closest GUI alternative is changing your DNS server in System Settings → Network → [your connection] → Details → DNS. Switching DNS servers doesn’t flush the cache, but it does start fresh lookups against the new servers.

Browser DNS caches are separate

Important: every modern browser also keeps its own DNS cache, separate from macOS’s. Flushing the system cache doesn’t clear the browser’s.

To clear browser DNS caches:

  • Chrome: type chrome://net-internals/#dns in the address bar → click Clear host cache.
  • Brave: same URL: brave://net-internals/#dns.
  • Edge: edge://net-internals/#dns.
  • Firefox: type about:networking#dns → click Clear DNS Cache.
  • Safari: no GUI option. Restarting Safari clears its DNS cache.
  • Arc: chrome://net-internals/#dns (it’s Chromium under the hood).

If you’re flushing DNS to fix a site issue, do both system flush and browser flush.

Skip the manual huntSweep clears every cache across every app in one pass — Slack, Spotify, Discord, browsers, and the rest. Download Sweep free →

Verifying it worked

You can test DNS resolution after a flush with:

dig example.com

or

nslookup example.com

These query DNS directly. If you set up a fresh DNS server and want to confirm your Mac is using it:

scutil --dns

Shows the current DNS configuration including which servers your Mac is querying.

When flushing DNS won’t help

A flush only helps if the problem is a cached DNS entry. It won’t fix:

  • A genuinely down website
  • An ISP-level DNS outage
  • A blocked domain (firewall, parental controls, content filters)
  • Issues at the application level (browser bugs, app misconfigurations)
  • Network connectivity problems below DNS (no internet, captive portal, etc.)

If you flush DNS and the problem persists, the issue is elsewhere.

Other DNS-adjacent things worth knowing

A few things that look like DNS cache issues but aren’t:

  1. /etc/hosts overrides — if a hostname maps to a specific IP in /etc/hosts, no DNS lookup happens at all. Check that file with sudo nano /etc/hosts if a domain refuses to behave normally.
  2. Search domains — System Settings → Network → Details → DNS. Search domains are appended to bare hostnames. Misconfigured ones cause weird routing.
  3. DNS over HTTPS (DoH) — if you’ve enabled DoH in your browser or via macOS profiles, DNS goes over HTTPS to a specific provider, bypassing system DNS. Different cache, different troubleshooting.

Commands that don’t help

A few internet myths:

  • Restarting Wi-Fi: doesn’t flush DNS cache.
  • Restarting your router: doesn’t flush your Mac’s cache.
  • Clearing browser cache: clears browser HTTP cache, not DNS cache.
  • Restarting your Mac: actually does flush DNS cache (since it’s an in-memory cache that doesn’t persist), but it’s overkill for just DNS.

The Terminal command is by far the fastest way.

There’s a faster waySweep finds and clears caches across every app you use, all at once. Try Sweep free →

Should you flush DNS regularly?

No. DNS cache exists for performance — clearing it makes every site you visit slightly slower until the cache rebuilds. Flush only when you need to.

Useful situations:

  • Right after changing DNS servers
  • Right after editing /etc/hosts
  • When troubleshooting a specific connectivity issue
  • After a DNS provider outage

Otherwise, leave it alone.

DNS cache vs. other Mac caches

The DNS cache is unique because it’s small (KB, not MB), in-memory only (gone on reboot), and serves a different purpose from app caches. Tools that “clean Mac caches” typically don’t include DNS — and shouldn’t, since DNS is a system networking concern, not a storage issue.

What Sweep does cover: app caches, browser caches, system caches that take up disk space, log files, and similar accumulated junk in ~/Library. That’s the storage-recovery side of cache management. DNS is its own thing — Terminal is the right tool there.

Bottom line

The command is sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder on macOS Sonoma 14 and Sequoia 15. Enter your password, no output means it worked. Test with dig or nslookup if you want confirmation.

Don’t forget your browser has its own DNS cache too. Both need clearing for a full reset.

← Back to all guides