sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponderClear the macOS DNS cache. Works on macOS 10.11 El Capitan through macOS 15 Sequoia.
When to use it
Flush the DNS cache when a website moved to a new server but your Mac still goes to the old one, after editing /etc/hosts, after changing DNS servers, or when one site fails with a DNS error while others work.
What is the DNS cache? macOS remembers recent name lookups (apple.com → 17.253.144.10) for as long as each record's TTL allows, so it doesn't have to ask DNS again. Usually that's good; after a change it can hand out stale answers.
Steps
Open Terminal
Applications › Utilities › Terminal, or search for it with Spotlight (⌘Space).Run the flush command
Paste the command and press Return. Type your administrator password when asked; it won't be shown as you type.sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponderClear the browser's own cache
Chrome keeps a separate DNS cache. Openchrome://net-internals/#dnsand click Clear host cache, thenchrome://net-internals/#sockets› Flush socket pools. Safari and Firefox use the system cache (Firefox may also need a restart).Check the result
Look the name up again. dscacheutil uses the same resolver path as apps.dscacheutil -q host -a name apple.com
Output explained
The flush command prints nothing when it works; that's expected. If you typed the password wrong, sudo asks again.
dscacheutil -q host -a name apple.com prints what macOS resolves now:
name: apple.com
ipv6_address: 2620:149:af0::10
name: apple.com
ip_address: 17.253.144.10
To see what's in the cache, run sudo killall -INFO mDNSResponder; mDNSResponder then writes its cache state to the system log, which you can read in the Console app by searching for mDNSResponder.
Options and variations
| Flag | Meaning | Example |
|---|---|---|
| dscacheutil -flushcache | Flush the Directory Service cache | sudo dscacheutil -flushcache |
| killall -HUP mDNSResponder | Tell mDNSResponder to drop its DNS cache | sudo killall -HUP mDNSResponder |
| dscacheutil -q host | Resolve a name the way apps do | dscacheutil -q host -a name example.com |
Common errors
| Error | Cause | Fix |
|---|---|---|
| Sorry, try again. | Wrong password for sudo | Use your Mac login password; the account must be an administrator. |
| Site still goes to the old server | The browser's own cache, the router's cache or the old TTL at your ISP | Clear Chrome's host cache, restart the router, or wait for the TTL. |
| No matching processes were found | Typo in mDNSResponder (it's case-sensitive) | Copy the command exactly. |
Do it in the app
After flushing, LightAtom's connections view shows connections with the addresses names now resolve to.
Frequently asked questions
How do I flush DNS on a Mac?
Open Terminal and run sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder, then enter your password. It works on every macOS version since 10.11 El Capitan, including macOS 15 Sequoia.
Is it safe to flush the DNS cache?
Yes. It only deletes remembered lookups, which macOS rebuilds automatically. The first visit to each site afterwards takes a few milliseconds longer.
Does restarting a Mac clear the DNS cache?
Yes, a restart clears it. The flush command just does it without restarting.
How do I flush DNS in Chrome?
Open chrome://net-internals/#dns and click Clear host cache. Then flush socket pools at chrome://net-internals/#sockets so existing connections close.
Why didn't flushing DNS fix my problem?
The stale answer may come from your router or ISP resolver, which keep their own caches. Restart the router or switch to a public DNS server, and wait for the old record's TTL.