Reset DNS Cache on Mac
Categories:
How to Effectively Reset Your DNS Cache on macOS

Learn why and how to clear your DNS cache on a Mac to resolve common internet connectivity and website access issues.
Your Mac, like most operating systems, maintains a local cache of DNS (Domain Name System) records. This cache stores the IP addresses of websites you've recently visited, allowing your browser to load them faster on subsequent visits. While beneficial for speed, an outdated or corrupted DNS cache can lead to problems such as being unable to access certain websites, seeing old versions of sites, or encountering 'server not found' errors. Resetting this cache forces your system to fetch fresh DNS information, often resolving these issues.
Understanding DNS Caching on macOS
DNS caching is a fundamental optimization technique. When you type a website address (like example.com
) into your browser, your computer needs to translate that human-readable domain name into an IP address (like 192.0.2.1
) that servers understand. This translation is handled by DNS servers. To speed up this process, your Mac temporarily stores these translations in its local DNS cache. This means that for frequently visited sites, your computer doesn't need to query a DNS server every single time, saving time and bandwidth.
However, if a website's IP address changes, or if there's an issue with the DNS record, your Mac might still be holding onto the old, incorrect information. This is where clearing the cache becomes essential. It's like telling your Mac, "Forget what you think you know about these websites, and ask for the latest information."
flowchart TD A[User types URL] --> B{Is URL in DNS Cache?} B -->|Yes| C[Retrieve IP from Cache] B -->|No| D[Query DNS Server] D --> E[Receive IP from DNS Server] E --> F[Store IP in Cache] C --> G[Connect to IP Address] F --> G G --> H[Load Website] H --> I{Website Loads Correctly?} I -->|Yes| J[End] I -->|No, Error| K[Reset DNS Cache] K --> A
DNS Resolution Process and Cache Interaction
When to Reset Your DNS Cache
While not an everyday task, resetting your DNS cache can be a powerful troubleshooting step in several scenarios:
- Website Access Issues: You can't reach a specific website, but others are working fine.
- Outdated Content: You're seeing an old version of a website even after it's been updated.
- DNS Propagation Delays: After migrating a website to a new host or changing DNS records, it can take time for these changes to propagate across the internet. Clearing your local cache can help you see the updated site sooner.
- Security Concerns: In rare cases, a corrupted DNS cache could be a vector for certain types of network attacks, though this is less common for typical users.
- General Network Troubleshooting: As a general step when diagnosing mysterious network problems.
How to Clear DNS Cache on macOS
The method for clearing the DNS cache on macOS has changed slightly with different versions of the operating system. It primarily involves using the Terminal application to execute specific commands. It's important to use the correct command for your macOS version.
1. Open Terminal
Navigate to Applications
> Utilities
> Terminal
, or use Spotlight Search (Cmd + Space) and type "Terminal".
2. Identify Your macOS Version
Click the Apple menu in the top-left corner of your screen, then select About This Mac
. Note down your macOS version (e.g., macOS Sonoma, Ventura, Monterey, Big Sur, Catalina, Mojave, High Sierra, Sierra, El Capitan).
3. Execute the Appropriate Command
Based on your macOS version, enter the corresponding command into the Terminal and press Enter. You will likely be prompted for your administrator password.
macOS Sonoma (14) / Ventura (13) / Monterey (12) / Big Sur (11)
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
macOS Catalina (10.15) / Mojave (10.14) / High Sierra (10.13) / Sierra (10.12)
sudo killall -HUP mDNSResponder
OS X El Capitan (10.11)
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
OS X Yosemite (10.10)
sudo discoveryutil mdnsflushcache; sudo discoveryutil udnsflushcaches
OS X Mavericks (10.9) / Mountain Lion (10.8) / Lion (10.7)
sudo killall -HUP mDNSResponder
OS X Snow Leopard (10.6)
sudo dscacheutil -flushcache
Verifying the DNS Cache Reset
While there's no direct command to 'view' the empty DNS cache, you can verify that the reset has taken effect by trying to access the problematic website again. If the issue was indeed related to an outdated DNS entry, it should now resolve correctly.
Another way to observe the effect is to use the dig
command before and after flushing the cache, though this is more for advanced users and observing network behavior rather than directly confirming the flush itself.
For example, you can use dig example.com
to see the current DNS resolution for a domain. After flushing, the first dig
command for a previously cached domain will take slightly longer as it has to query a DNS server, indicating the cache was indeed cleared.