How-to
How to flush the DNS cache on a Mac
Last updated November 10, 2026
To flush the DNS cache on a Mac, open Terminal, run sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder and enter your password.
The command prints nothing when it works. It is the same on every current release, including macOS 27 Golden Gate,
macOS 26 Tahoe and macOS 15 Sequoia.
macOS has no button for this anywhere in System Settings, so Terminal is the only direct route. It is a single line, though, and you can paste it. Below you will find the steps, what the two halves of the command do, the commands for older versions back to Mac OS X Tiger, and how to tell whether the flush changed anything. For other systems, see the overview for every device.
Flush the DNS cache in Terminal
- Open Terminal: press
Cmd + Space, typeTerminaland press Return. You can also find it under Applications → Utilities. - Paste the command below and press Return.
- Type your Mac login password and press Return. The cursor does not move and no dots appear while you type. That is how Terminal handles passwords, not a frozen window.
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder If the prompt simply comes back, it worked. macOS gives no confirmation. You need to be signed in with an administrator
account, because sudo runs the command with system rights.
What the two commands do
The line is really two commands separated by a semicolon:
sudo dscacheutil -flushcacheempties the Directory Service cache, where macOS keeps the results of lookups made through its directory services (user and group information as well as host names).sudo killall -HUP mDNSRespondersends a "hang up" signal to mDNSResponder, the background process that handles DNS lookups for the system and its apps and also runs Bonjour. Despite the namekillall, nothing is killed: the process stays up, throws away its cached records and carries on. Your connections stay open.
On current versions the second command does the actual DNS work. The first is a harmless extra, kept because the pair
works across the widest range of macOS releases. Apple's own manual page for dscacheutil says a flush
"should only be used in extreme cases", which is a fair hint that macOS expires outdated records well on its own and you
will rarely need this.
Commands for older macOS and OS X versions
Apple has changed the resolver a few times, and the command changed with it. Check your version under Apple menu → About This Mac, then use the matching line:
Flush DNS command by macOS version
- macOS 11 Big Sur and later, including 15 Sequoia, 26 Tahoe and 27 Golden Gate
- Command sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
- OS X 10.10.4 Yosemite to macOS 10.15 Catalina
- Command sudo killall -HUP mDNSResponder
- OS X 10.10 to 10.10.3 Yosemite
- Command sudo discoveryutil mdnsflushcache; sudo discoveryutil udnsflushcaches
- OS X 10.7 Lion to 10.9 Mavericks
- Command sudo killall -HUP mDNSResponder
- Mac OS X 10.5 Leopard and 10.6 Snow Leopard
- Command sudo dscacheutil -flushcache
- Mac OS X 10.4 Tiger
- Command lookupd -flushcache
| macOS version | Command |
|---|---|
| macOS 11 Big Sur and later, including 15 Sequoia, 26 Tahoe and 27 Golden Gate | sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder |
| OS X 10.10.4 Yosemite to macOS 10.15 Catalina | sudo killall -HUP mDNSResponder |
| OS X 10.10 to 10.10.3 Yosemite | sudo discoveryutil mdnsflushcache; sudo discoveryutil udnsflushcaches |
| OS X 10.7 Lion to 10.9 Mavericks | sudo killall -HUP mDNSResponder |
| Mac OS X 10.5 Leopard and 10.6 Snow Leopard | sudo dscacheutil -flushcache |
| Mac OS X 10.4 Tiger | lookupd -flushcache |
The odd one out is early Yosemite. Apple replaced mDNSResponder with a new process called discoveryd in OS X
10.10, ran into a long list of networking bugs, and brought mDNSResponder back in 10.10.4. If you are unsure which line
applies, the two-part command from the top of this page is safe on anything from Lion onwards, with those early Yosemite
builds as the only exception.
Check that the flush worked
Because there is no success message, the only proof is a fresh lookup. Ask the system resolver for a name:
dscacheutil -q host -a name example.com This goes through the same path your apps use, cache included, and prints the address macOS currently has for that name. Now compare it with the answer straight from a DNS server:
dig example.com +short dig (like nslookup and host) ignores the macOS cache and talks to the DNS server
directly. That makes it a poor test of whether your cache is empty, but a very good way to see what DNS says right now:
- Both show the new address: the flush worked and DNS is up to date. If a browser still opens the old site, the browser is the one caching.
digshows the new address,dscacheutilthe old one: something on the Mac still overrides DNS, most often a line in/etc/hosts.- Both show the old address: your DNS server has not picked up the change yet. No flush on your Mac can fix that. Wait for the TTL to expire, or check the record from outside your network with our DNS lookup.
Safari, Chrome and Firefox on a Mac
- Safari uses the macOS resolver and has no DNS cache setting. After flushing, quit it completely with
Cmd + Q(closing the window is not enough) and open it again, so it drops the connections it still holds to the old address. - Chrome, Edge and Brave: open
chrome://net-internals/#dnsand click Clear host cache. - Firefox: open
about:networking#dnsand click Clear DNS Cache.
Two features send lookups around your local cache altogether: iCloud Private Relay, which resolves Safari's names through Apple's relay, and secure DNS in Chrome or Firefox. If a flush makes no difference in one browser only, switch that feature off for a minute and test again.
Turn it into a one-word command
If you flush DNS regularly, for example while developing websites or moving domains between servers, save yourself the
typing. Add this line to the file ~/.zshrc (zsh has been the default shell since macOS Catalina):
alias flushdns='sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder' Open a new Terminal window and type flushdns. macOS asks for your password as before, then runs both
commands.
Troubleshooting
"Sorry, try again." The password was wrong. Remember that nothing is shown while you type. Enter it carefully and press Return.
"… is not in the sudoers file." Your account is a standard user, and only administrators may use sudo. Sign in with an administrator account, or run su adminname in Terminal first (with the
short name of an administrator in place of adminname) and then the flush command.
"No matching processes belonging to you were found." The killall half ran without sudo. Make sure both halves start with sudo, as in the command above.
The site still resolves to the old address. Look for a manual override with cat /etc/hosts.
Then rule out a VPN or a DNS profile: System Settings → Network → your connection → Details → DNS lists the DNS servers
your connection really uses. Finally, restart the router, which keeps a cache of its own.
You edited /etc/hosts and nothing changed. Flush the cache. macOS can keep answering from memory until you do.
Frequently asked questions
What is the command to flush DNS on a Mac?
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder. Paste it into Terminal, press Return and enter your password. It works on macOS 11 Big Sur and everything newer, including Sequoia, Tahoe and Golden Gate.
Why does Terminal show nothing after I run the command?
Because macOS prints no confirmation for it. Silence means success: if the prompt returns without an error message, the cache has been flushed.
Do I need to restart my Mac after flushing the DNS cache?
No, the flush works immediately. A restart is in fact the alternative for anyone who wants to avoid Terminal, since the DNS cache is kept in memory and is empty after every boot.
Is it safe to flush the DNS cache on a Mac?
Yes. The cache only contains copies of public DNS answers, and macOS refills it automatically as you browse. No files, settings or passwords are affected.
Is the command different on Apple silicon and Intel Macs?
No. The command depends on the macOS version, not on the processor. An M-series Mac and an Intel Mac running the same macOS use the same command.
Can I flush the DNS cache on a Mac without Terminal?
There is no button for it in System Settings. Restarting the Mac clears the cache as a side effect. For Chrome and Firefox you can clear the browser's own DNS cache from a settings page without touching Terminal.
What is mDNSResponder?
It is the macOS system process that resolves names. It handles ordinary DNS lookups for your apps and runs Bonjour, the service that finds printers, AirPlay devices and other Macs on the local network. It also holds the DNS cache, which is why the flush command targets it.