To flush DNS cache on macOS, open Terminal and run sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder. This two-part command clears your Mac's stored DNS records and restarts the DNS resolver in a single step. Understanding
what is DNS cache helps explain why this fix works. Your Mac stores website address data locally, and when those records go stale, browsing breaks. This guide covers the exact command for every macOS version, common errors, and how to verify the flush worked. One 30-second fix might be all that stands between you and a working internet connection.
Key Takeaways
- The correct command to flush DNS on modern macOS is sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder - both parts must run together.
- Flushing DNS does not reset passwords, log you out of websites, or change your network settings.
- You do not need to restart your Mac after flushing DNS, the change takes effect immediately.
- Different macOS versions use different flush commands — always match the command to your OS version for it to work.
- mDNSResponder is the macOS process that handles DNS resolution; restarting it with -HUP applies the flush without a full reboot.
- Flushing DNS fixes errors like "This site can't be reached," outdated IP redirects, and post-migration website loading failures but will not increase raw internet speed.
- Running the command requires administrator privileges; always enter your Mac login password when prompted.
What Does the Flush DNS Command Do on macOS?
The flush DNS command clears your Mac's locally stored DNS records and forces the DNS resolver service to start fresh. When you run sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder, your Mac discards all cached website-to-IP address mappings and rebuilds them by querying your DNS server on the next request.
Your Mac builds a DNS cache over time by saving the results of every domain lookup it performs. When you type "example.com" into a browser, macOS checks this local cache first before reaching out to an external DNS server. This process speeds up browsing considerably, but it becomes a problem when the cached data no longer matches reality. For example, after a website migrates to a new server or after a DNS record update is pushed by an administrator.
Flushing the cache removes all those stored records at once, forcing your Mac to fetch fresh, accurate data the next time you visit any website. The result is that stale, conflicting, or corrupted DNS entries are permanently cleared in seconds.
Breaking Down the Command
The command sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder is actually two separate instructions joined by a semicolon:
- sudo — Runs the command with administrator-level permissions, which are required to modify system-level DNS data.
- dscacheutil -flushcache — Clears the DNS cache stored in macOS's Directory Services cache utility.
- ; — A shell operator that runs the second command immediately after the first finishes.
- sudo killall -HUP mDNSResponder — Sends a "hang up" signal to the mDNSResponder process, causing it to reload its configuration without being fully terminated.
Running only one part of this command on modern macOS versions will produce an incomplete flush. Both parts are required for a full, effective DNS cache reset.
When Should You Flush DNS Cache on a Mac?
You should flush DNS cache on a Mac when you encounter browsing errors that point to stale or incorrect DNS data — such as sites that fail to load after a server migration, pages that redirect to the wrong destination, or connection errors on sites you know are online.
The most common situations that call for a DNS flush include:
- Websites returning a "This site can't be reached" error even though you know the site is live.
- A recently migrated website still loading the old version because your Mac cached the old server's IP address.
- DNS-related SSL errors where the certificate doesn't match because the domain is resolving to the wrong IP.
- Slow or inconsistent DNS resolution caused by a bloated or partially corrupted cache.
- After changing your DNS server settings (e.g., switching to Google DNS or Cloudflare) and needing the change to take effect immediately.
Security concerns, where you want to remove DNS records that may have been poisoned or tampered with.
You do not need to flush your DNS cache on a regular schedule. macOS automatically expires and refreshes DNS records based on each domain's TTL (Time to Live) value. Only flush when you have a specific browsing problem that points to a DNS conflict.
How to Flush DNS Cache on macOS?
Flushing DNS cache on macOS takes less than 60 seconds and requires only Terminal and your administrator password. Follow these steps exactly.
Step 1: Open Terminal
Launch the Terminal application on your Mac. You can do this in three ways:
- Press Command + Space to open Spotlight, type Terminal, then press Enter.
- Open Finder → Applications → Utilities → Terminal.
- Use Launchpad, search for Terminal, and click it.
Terminal is a command-line interface that allows you to run system-level commands directly on macOS.
Step 2: Run the Flush DNS Command
In the Terminal window, type or paste the following command exactly as shown:
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
Press Return to execute it. Make sure you copy the entire line — both parts separated by the semicolon are required for the flush to work on macOS Monterey, Ventura, Sonoma, and Sequoia.
Step 3: Enter Your Admin Password
After pressing Return, Terminal will prompt you with:
Password:
Type your Mac administrator password and press Return. Note that the cursor will not move and no characters will appear while you type — this is normal macOS security behavior. If you type the wrong password, you will see a "Sorry, try again" message and be prompted to re-enter it.
Step 4: Verify the DNS Cache Was Cleared
On modern macOS versions, a successful flush produces no output, a blank prompt is confirmation that it worked. However, you can verify the flush with a secondary check:
- Open Safari or Chrome and visit a site that was previously broken.
- Alternatively, open Terminal and run nslookup [domain] to see a fresh DNS lookup result.
- On older macOS versions with verbose logging enabled, you may see a success message in the Console app.
If you receive an error message instead of a blank response, refer to the troubleshooting section below.
Flush DNS Commands for Different macOS Versions
Different versions of macOS use different DNS flushing commands. Using the wrong command for your OS version will either do nothing or return an error. Find your macOS version under Apple Menu → About This Mac and use the matching command.
| macOS Version | Release Name | DNS Flush Command | | macOS 15 | Sequoia | sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder | | macOS 14 | Sonoma | sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder | | macOS 13 | Ventura | sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder | | macOS 12 | Monterey | sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder | | macOS 11 | Big Sur | sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder | | macOS 10.15 | Catalina | sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder | | macOS 10.14 | Mojave | sudo killall -HUP mDNSResponder | | macOS 10.13 | High Sierra | sudo killall -HUP mDNSResponder | | macOS 10.12 | Sierra | sudo killall -HUP mDNSResponder | | OS X 10.11 | El Capitan | sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder | | OS X 10.10 | Yosemite | sudo discoveryutil udnsflushcaches | | OS X 10.9 | Mavericks | dscacheutil -flushcache; sudo killall -HUP mDNSResponder |
| | |
|---|
| |
|
If you are on macOS 10.15 Catalina or later, always use the full two-part command: sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder.
What is mDNSResponder in macOS?
mDNSResponder is a background system process in macOS responsible for handling all DNS resolution and Bonjour (mDNS) network discovery. It is the core service that translates domain names into IP addresses every time you connect to a website, server, or network service on your Mac.
Apple introduced mDNSResponder as part of the Bonjour networking protocol, which is used to discover printers, AirPlay devices, shared Macs, and other network services without requiring manual configuration. In addition to local network discovery, mDNSResponder also manages all standard DNS queries for internet traffic.
When you run sudo killall -HUP mDNSResponder, you are sending a SIGHUP (Signal Hang Up) signal to the process. Unlike killing a process outright, SIGHUP instructs mDNSResponder to gracefully reload its configuration and discard its cached records — effectively applying the DNS flush that dscacheutil -flushcache initiated. This is why both commands must be run together: dscacheutil clears the cache data, and the mDNSResponder restart ensures the process picks up the cleared state.
Common Problems After Flushing DNS Cache
Most DNS flush attempts on macOS are straightforward, but a few errors can appear depending on your system configuration or macOS version.
Command Not Found
If Terminal returns command not found, you are likely using the wrong command for your macOS version. Check your macOS version under Apple Menu → About This Mac and use the correct command from the version table above. For example, macOS 10.10 Yosemite requires sudo discoveryutil udnsflushcaches, not the dscacheutil command.
Operation Not Permitted
This error appears when the command is run without sudo or when System Integrity Protection (SIP) is blocking the action. Always include sudo at the beginning of each part of the command. If SIP is causing the issue, you should not disable it — instead, confirm you are using the exact correct syntax and that your user account has administrator privileges enabled in System Settings → Users & Groups.
No Internet After Flush
A DNS flush does not cause internet disconnections — if your internet stops working after the flush, it was already failing before the command ran or the issue is unrelated to DNS. Check your Wi-Fi or Ethernet connection, confirm your DNS server settings in System Settings → Network, and try restarting your router. Running ping 8.8.8.8 in Terminal will tell you whether your connection itself is live.
Password Not Working
Terminal accepts your Mac login password, not your Apple ID or any other credential. If the password appears incorrect, confirm the right account has admin rights in System Settings → Users & Groups. Remember that no characters display while typing your password in Terminal — type carefully and press Return. After five failed attempts, you may need to wait or restart Terminal to try again.
Flush DNS Cache vs Restarting Your Mac
Flushing DNS cache and restarting your Mac both clear DNS records, but they are not equivalent operations. Flushing DNS is faster, targeted, and requires no downtime — it clears only the DNS cache and restarts only the DNS resolver process, leaving everything else untouched. A full Mac restart also clears DNS records but goes much further: it resets all running processes, clears RAM, restarts system services, and can resolve issues far beyond DNS.
If your only problem is a DNS-related browsing error, flushing the DNS cache is the correct and more efficient solution. It takes under 60 seconds compared to the 1–3 minutes a full restart requires, and it lets you stay in the middle of other work without closing open apps or losing unsaved data.
However, if you are experiencing broader system issues — slow performance, multiple services behaving unexpectedly, or network problems that persist after a DNS flush — a full restart may be the better next step. Think of a DNS flush as a scalpel and a restart as a reset button: use the right tool for the problem at hand.
How to Check DNS Records on macOS
You can check current DNS records directly from Terminal using the nslookup or dig command — both are built into macOS and require no additional installation.
To look up a domain's DNS records:
- Open Terminal.
- Run: nslookup example.com — Replace example.com with any domain you want to check.
- The output shows the DNS server used and the IP addresses the domain resolves to.
For more detailed DNS record information, use the dig command:
- dig example.com — Returns the A record (IPv4 address).
- dig example.com AAAA — Returns the IPv6 address.
- dig example.com MX — Returns mail server records.
- dig example.com NS — Returns nameserver records.
You can also check which DNS servers your Mac is currently using by running scutil --dns in Terminal. This outputs your full DNS configuration including search domains, resolver addresses, and query order — useful for confirming that a DNS server change has taken effect after flushing the cache.
Does Flushing DNS Improve Internet Speed?
Flushing DNS does not directly improve internet speed in any measurable way for general browsing. The DNS cache is designed to speed up browsing — clearing it means your Mac must perform fresh DNS lookups for every domain until the cache rebuilds, which can very temporarily slow the first load of familiar websites.
However, if your DNS cache contains stale or corrupted entries, those bad records can cause delays while macOS repeatedly tries to resolve a domain against an outdated IP. In that specific scenario, flushing the cache removes the bottleneck and restores normal resolution times — which can feel like a speed improvement even though the underlying connection speed is unchanged.
If you are looking to genuinely improve DNS resolution speed, switching to a faster public DNS server is more effective. Google DNS (8.8.8.8) and Cloudflare DNS (1.1.1.1) are consistently faster than many ISP-provided DNS servers and can reduce lookup times noticeably. You can change your DNS server in System Settings → Network → [Your Connection] → DNS.
Is It Safe to Flush DNS Cache on Mac?
Yes, flushing DNS cache on macOS is completely safe. The DNS cache is a temporary data store. It contains no personal data, no saved passwords, no session tokens, and no files. Clearing it carries no risk of data loss, system instability, or permanent configuration changes.
The only effect of flushing the cache is that your Mac will need to perform fresh DNS lookups for websites you visit immediately afterward, which adds a fraction of a second to the first load of each domain. This is temporary; the cache rebuilds itself automatically within minutes of normal browsing.
Flushing DNS will not log you out of websites, reset browser history, affect Wi-Fi or VPN connections, or change any system settings. It is one of the safest troubleshooting steps you can take on a Mac, and running sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder even when you are unsure whether it is needed will cause no harm.
Conclusion
Flushing DNS cache on macOS is a simple, safe, and immediately effective fix for a specific class of browsing problems — stale records, wrong redirects, and domain resolution failures that persist even when a website is fully online. The command sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder handles the job completely on any Mac running macOS 10.15 Catalina or later.
The most important thing to remember is that DNS flushing is not a cure-all. It solves DNS-specific issues — not connection drops, slow bandwidth, or hardware problems. Use it when the symptoms match: a site that should load but won't, a recently moved domain still pointing to the old server, or a DNS error message in your browser.
For ongoing browsing reliability, pair periodic DNS flushes with a quality public DNS provider. The flush clears what's broken; a fast DNS server ensures what replaces it is both accurate and quick.
FAQs
1. How often should I flush the DNS cache on Mac?
There is no recommended routine schedule for flushing DNS on a Mac. macOS automatically manages DNS record expiry based on each domain's TTL value. Only flush your DNS cache when you encounter a specific browsing problem that points to stale or incorrect DNS data, such as a site not loading after a known server migration or a persistent "This site can't be reached" error on a live site.
2. Will flushing DNS log me out of websites?
No. Flushing DNS cache has no effect on browser sessions, login cookies, or saved passwords. Your login state on websites is stored in your browser, not in the DNS cache. You will remain logged into every site you are currently signed into after running sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder.
3. Do I need to restart my Mac afterwards?
No restart is required. The DNS flush takes effect immediately after the command runs. The mDNSResponder process restarts itself within the command, so all subsequent DNS lookups automatically use the cleared cache. You can continue using your Mac and browsing the web right away.
4. Can flushing DNS fix "This site can't be reached"?
Yes, in many cases. The "This site can't be reached" error in Chrome and Safari is frequently caused by a stale or corrupted DNS record pointing to an old or invalid IP address. Flushing the DNS cache removes that bad record and forces a fresh lookup, which often resolves the error immediately. However, if the site itself is down or your internet connection is the problem, a DNS flush will not help.
5. What happens if mDNSResponder is restarted?
When you run sudo killall -HUP mDNSResponder, the process receives a SIGHUP signal and gracefully reloads its configuration, discarding all cached DNS records in the process. It does not shut down, it restarts within milliseconds. During that brief moment, any DNS query in progress is rescheduled automatically. There is no noticeable disruption to your network activity, and all Bonjour-based services (AirPlay, shared printers, etc.) continue working normally.