> ## Content Index
> Fetch the complete content index at: https://macfixly.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# How to Flush DNS Cache in Mac Terminal: Step-by-Step Guide
- URL: https://macfixly.com/flush-dns-cache-mac-terminal/
- Published: 2026-10-14T05:00:00.000Z
- Updated: 2026-10-14T05:00:00.000Z
- Description: This guide shows how to flush DNS cache in Mac Terminal to fix connection problems and update stale DNS entries effectively.
- Author: Macuser
- Tags: MacOS, Networking, DNS, Terminal Commands

Sometimes, your Mac may struggle to connect to websites or display outdated content due to stale DNS cache entries. When this happens, refreshing your DNS cache can resolve these issues quickly.

This article explains how to flush DNS cache in Mac Terminal, guiding you through the exact commands for different macOS versions and troubleshooting steps if standard methods fail. You’ll also learn how to handle DNS caching when using third-party services or specific network interfaces, and how to confirm the cache has been cleared successfully.

## Key takeaways

- The DNS flush command varies depending on your macOS version—using the correct one is essential.
- Administrator privileges are required to execute DNS cache flush commands.
- Third-party DNS services may require additional steps beyond standard Terminal commands.
- You can target specific network interfaces when clearing DNS cache for more precise troubleshooting.
- Verifying the cache flush helps ensure your network issues are properly addressed.

## Before you start: What you need to flush DNS cache on Mac

Flushing the DNS cache on your Mac requires administrator privileges because the process affects system-level network settings. You will need to use **sudo** in Terminal to run the necessary commands, which means you must have an administrator account and know its password.

Knowing your macOS version is crucial since the DNS flush commands differ across releases. Using the wrong command might not clear the cache, leaving DNS issues unresolved.

Before flushing, close apps that heavily rely on network connections, such as web browsers, VPN clients, or messaging apps. These applications may interfere with the cache flush or keep stale DNS data in memory.

The DNS cache stores recent domain name lookups to speed up network access. However, if the cache holds outdated or incorrect entries, you might experience failures reaching specific websites or services.

1. Try accessing a website that recently changed its DNS records and see if it fails to load.
2. Flush the DNS cache using the appropriate command for your macOS version with **sudo**.
3. After the flush, reload the website. It should now resolve correctly, indicating the cache was successfully cleared.

Following these preparations ensures that flushing the DNS cache will work smoothly and effectively resolve name resolution problems on your Mac.

## How to flush DNS in Mac Terminal using the correct command for your macOS version

Flushing the DNS cache on a Mac requires using different Terminal commands depending on your macOS version due to changes in system architecture over time. First, identify your macOS version by opening Terminal and typing **sw\_vers -productVersion**. This command returns a version number like *10.15.7* or *12.3*.

| macOS Version                                                | Terminal Command to Flush DNS Cache                           |
| ------------------------------------------------------------ | ------------------------------------------------------------- |
| macOS 10.10.4 to 10.15 (Yosemite to Catalina)                | sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder |
| macOS 11.0 and later (Big Sur, Monterey, Ventura and beyond) | sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder |
| macOS 10.10 to 10.10.3 (Yosemite early updates)              | sudo discoveryutil mdnsflushcache                             |

1. Open Terminal from *Applications > Utilities*.
2. Check your macOS version by typing `sw_vers -productVersion` and pressing Enter.
3. Based on your version, enter the matching command from the table above, for example:  
`sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder`
4. Press Enter and input your administrator password when prompted; the Terminal will not show characters as you type.
5. Wait a few seconds; successful execution returns to the prompt without error messages.

Each command combination targets the DNS caching service relevant to your macOS version. The use of `sudo` requires administrator rights, and the `killall -HUP mDNSResponder` part restarts the DNS responder process, ensuring the cache is cleared.

Note that some earlier macOS versions used `discoveryutil` instead of `mDNSResponder`, reflecting architectural changes Apple has made. Using the wrong command for your macOS version may result in no cache clearing or errors.

## How to clear DNS cache in Mac Terminal when standard commands don’t work

If the usual commands to flush your DNS cache fail or show no effect, several common issues might be causing the problem. These include using a command for the wrong macOS version, syntax errors, or missing administrator privileges (sudo). Confirming whether the DNS cache was actually flushed is crucial before trying alternatives.

![How to clear DNS cache in Mac Terminal when standard commands don’t work – how to flush DNS cache in Mac Terminal](https://macfixly.com/content/images/2026/10/flush-dns-cache-mac-terminal-2.webp)

1. **Check command syntax and permissions:** Ensure you typed the command exactly as required for your macOS version and included `sudo` at the start. If you see a *command not found* or permission denied error, retry with the correct syntax and administrator rights. When successful, you should see no error message and your Terminal prompt returns.
2. **Verify DNS cache flush:** Test DNS resolution using `scutil --dns` or by running a `dig` command on a domain before and after flushing. If the IP addresses or cache timestamps update, the flush worked. If not, the cache may not have cleared.
3. **Use alternative commands:** For macOS versions where `killall -HUP mDNSResponder` doesn’t work, try restarting the mDNSResponder service manually with `sudo launchctl stop com.apple.mDNSResponder` followed by `sudo launchctl start com.apple.mDNSResponder`. You should see no error messages if successful.
4. **Restart related services:** In some cases, flushing the DNS cache requires restarting the discoveryd or mDNSResponder daemon depending on your macOS version. Check your system logs for related errors to confirm.
5. **Reboot your Mac as a last resort:** If none of the commands clear your DNS cache, rebooting your Mac will reset network services and clear the cache. This is effective but disrupts your workflow, so try other methods first.

For example, a user running macOS Big Sur entered `sudo killall -HUP mDNSResponder` but saw no change in DNS resolution. After verifying no syntax errors and confirming administrator access, they restarted the mDNSResponder service using `launchctl` commands, which successfully cleared the cache and resolved stale DNS entries.

## How to flush DNS cache in Mac OS when using third-party DNS services

Third-party DNS providers and VPN software often maintain their own DNS caches independent of macOS's built-in cache. This can result in outdated DNS entries persisting even after you flush the macOS DNS cache through Terminal commands.

To fully clear DNS entries when using these services, you need to flush the cache within the third-party app or network profile itself.

1. Identify the third-party DNS or VPN app managing your network connection. Common examples include Cloudflare's 1.1.1.1 app, NordVPN, or Cisco AnyConnect.
2. Open the app and locate the DNS or network settings. Look for an option labeled "Clear DNS Cache," "Flush DNS," or similar.
3. Execute the flush command within the app. You should see a confirmation message or status indicator that the DNS cache has been cleared.
4. If no explicit flush option exists, disconnect and reconnect the VPN or DNS service. This often forces the app to reset its DNS cache.
5. After clearing the third-party cache, flush the macOS DNS cache again via Terminal to synchronize caches.
6. Verify cache clearance by running a DNS lookup (e.g., via *dig* or *nslookup*) for a domain you expect to have updated records.

For example, when connected to a VPN, you might flush the VPN app's DNS cache, reconnect the VPN, then run the macOS Terminal flush command. Afterward, querying a recently changed domain should reflect the updated DNS information, confirming that both caches are cleared.

Because macOS network extensions and system-level DNS caching operate separately from third-party apps, managing both caches ensures comprehensive DNS refresh and minimizes network resolution errors.

## How to clear the local DNS cache in Mac OS for specific network interfaces

Flushing the DNS cache tied to a particular network interface can be useful when you suspect that DNS issues are isolated to one connection type—such as Wi-Fi or Ethernet. This targeted approach helps avoid disrupting other active network interfaces and can be especially helpful for troubleshooting connectivity problems that differ by interface.

Mac OS does not provide a direct command to flush DNS cache per interface, but you can achieve a similar effect by restarting the network service associated with that interface or manually renewing its DHCP lease. This forces the system to reset cached DNS entries linked to the specific connection.

1. Open Terminal and identify the network interfaces by typing **networksetup -listallhardwareports**. You will see interface names like *en0* (commonly Ethernet) and *en1* or *en2* (commonly Wi-Fi).
2. To renew the DHCP lease for a specific interface (for example, Wi-Fi on *en1*), run **sudo ipconfig set en1 DHCP**. This refreshes the network configuration and clears the DNS cache related to that interface. If successful, your connection may briefly drop and reconnect.
3. Alternatively, you can turn the interface off and on using **networksetup**: run **sudo networksetup -setnetworkserviceenabled "Wi-Fi" off**, then **sudo networksetup -setnetworkserviceenabled "Wi-Fi" on**. This restart often clears interface-specific caches.
4. Verify connectivity and DNS resolution by using **ping** or **dig** commands. For example, **dig example.com** should return current DNS data without errors.

Use cases include troubleshooting when Wi-Fi resolves domains correctly but Ethernet does not, or vice versa. Interface-specific flushing avoids the need to restart the entire DNS service or reboot the Mac, offering a more precise method for resolving localized DNS problems.

## How to verify DNS cache has been flushed successfully on Mac

After flushing your DNS cache, confirming the action was effective helps ensure your Mac resolves domain names accurately. You can verify this by checking DNS cache entries, testing DNS resolution, and using network diagnostic tools.

1. **Query DNS cache status:** Open Terminal and run `sudo killall -INFO mDNSResponder`. This command prompts macOS to log current DNS cache statistics. Then, view the log by entering `log show --debug --predicate 'process == "mDNSResponder"' --last 1m`. A mostly empty or reset cache section indicates a successful flush.
2. **Test DNS resolution before and after flushing:** Use `dig example.com` or `nslookup example.com` to query a domain’s IP address. Before flushing, cached TTL (Time To Live) values may be higher. After flushing, TTL should reset, typically showing a fresh lookup with higher TTL values.
3. **Use network diagnostic tools:** Run `scutil --dns` to inspect current DNS configuration and active resolver information. Additionally, open the Network Utility app or use `ping example.com` to confirm connectivity and resolution changes. If DNS flush worked, ping should resolve the domain without delay or stale IPs.

Sample output after flush may include log entries like *"Cache flushed"* or absence of prior cached entries in the mDNSResponder debug logs. Conversely, persistent cache entries or unchanged TTL values suggest the flush did not fully apply.

## Common issues and troubleshooting when flushing DNS cache on Mac Terminal

Flushing the DNS cache on Mac can sometimes present errors or unexpected results. Here are frequent problems, their causes, and practical fixes to help you resolve issues effectively.

![Common issues and troubleshooting when flushing DNS cache on Mac Terminal – how to flush DNS cache in Mac Terminal](https://macfixly.com/content/images/2026/10/flush-dns-cache-mac-terminal-3.webp)

### Top error messages and solutions

| Error message                            | Explanation                                                                   | How to fix                                                                                                                                          |
| ---------------------------------------- | ----------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
| "Permission denied"                      | You need administrator privileges to run DNS flush commands.                  | Use **sudo** before the command and enter your admin password when prompted.                                                                        |
| "Command not found"                      | The DNS flush command might be mistyped or unavailable in your macOS version. | Confirm the exact command for your macOS version and check spelling carefully.                                                                      |
| "mDNSResponder: Operation not permitted" | System Integrity Protection (SIP) may restrict flushing operations.           | Ensure you have admin rights and try running Terminal in recovery mode if necessary, but avoid disabling SIP unless you fully understand the risks. |

### What to do if DNS problems persist after flushing

If issues continue despite flushing, try restarting your Mac to reset network services fully. You can also reset network settings by navigating to *System Preferences > Network*, selecting your interface, and clicking *Advanced* to renew leases or remove problematic configurations.

Persistent DNS resolution failures may also stem from your ISP’s DNS servers. Contact your ISP for assistance or consider switching to a reliable third-party DNS provider.

### Warnings about flushing DNS cache too frequently

Repeatedly flushing the DNS cache is generally unnecessary and can temporarily degrade network performance by forcing repeated DNS lookups. Use this action judiciously, primarily when troubleshooting connectivity or domain resolution issues.

## More on this topic

- [How to Set Custom DNS on Mac: Step-by-Step Guide](https://macfixly.com/set-custom-dns-mac/)
- [How to Share Internet from Mac to Mac: A Clear Step-by-Step Guide](https://macfixly.com/share-internet-mac-mac/)
- [How to Use a VPN Profile on Mac: A Clear Step-by-Step Guide](https://macfixly.com/use-vpn-profile-mac/)
- [How to Show Hidden Files Using Mac Terminal: A Clear Step-by-Step Guide](https://macfixly.com/show-hidden-files-mac-terminal/)

## Frequently asked questions

### How to clear dns cache mac terminal?

To clear the DNS cache via Mac Terminal, open Terminal and enter the command specific to your macOS version, often **sudo killall -HUP mDNSResponder**. You may need to enter your administrator password. This command forces macOS to flush the DNS cache and reload DNS information.

### How to flush dns cache mac?

Flushing the DNS cache on a Mac involves running a Terminal command that restarts the DNS resolver service. The exact command varies by macOS version, but commonly **sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder** works for recent releases. This clears cached DNS records to resolve domain name resolution issues.

### How to flush dns on mac?

Use the Terminal app to flush DNS by executing the appropriate command for your system. For example, **sudo killall -HUP mDNSResponder** is widely supported. Remember to close and reopen your browser or restart network services if DNS issues persist after flushing.

### How to flush dns cache on macos?

On macOS, flushing the DNS cache requires a Terminal command that varies depending on the macOS version you run. For many versions, **sudo killall -HUP mDNSResponder** is effective. Always confirm your macOS version to use the correct command and avoid errors.

### how to flush dns in mac

Flushing DNS on a Mac is done via Terminal by running commands like **sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder**. This action clears outdated DNS data, helping fix connection problems. Make sure you have administrator rights to execute these commands.

## What flushing DNS cache does not cover and when to seek other solutions

Flushing your DNS cache can resolve many issues related to outdated or incorrect DNS information, but it does not fix all network problems. If you continue to experience connectivity issues, consider restarting your router, checking your internet service provider's status, or investigating app-specific settings. Some problems stem from deeper network configurations or hardware faults that require specialized troubleshooting beyond DNS cache clearing.

For persistent issues, IT professionals or network administrators might need to analyze network logs or use diagnostic tools tailored to complex environments.

After flushing your DNS cache, the single most useful next step is to test your internet connection by visiting a known website or using terminal commands like **ping** or **dig**. This helps confirm that your Mac is resolving domain names correctly and that the DNS flush had the intended effect.