How to Flush DNS Cache on macOS
- by Staff
Flushing the DNS cache on macOS is a vital step when troubleshooting DNS-related issues, particularly during or after DNS propagation. When a domain’s DNS records are updated—such as switching to a new hosting provider, modifying mail server records, or pointing to a content delivery network—it may take time for the changes to be recognized across the internet. However, even after external DNS propagation is complete, the local system on a Mac may continue to serve outdated DNS information due to internal caching. Clearing this cache ensures that your system retrieves the most current DNS records directly from authoritative sources instead of relying on stale data.
macOS, like other modern operating systems, caches DNS lookups to improve performance. Each time you visit a website, your system stores the IP address associated with the domain so future visits can be resolved more quickly. This behavior is generally helpful but becomes a problem when DNS records change and your machine does not immediately recognize the update. Instead, it keeps directing traffic based on the previously cached information, which can lead to connection failures, loading outdated content, or misrouted email traffic.
The method to flush DNS cache on macOS varies slightly depending on the version of the operating system, as Apple has changed the underlying DNS resolver frameworks over the years. However, starting with OS X Yosemite (10.10) and continuing through the latest macOS versions like Ventura and Sonoma, Apple has standardized the process to involve both the system DNS cache and the multicast DNS responder, which are part of the Bonjour service.
To flush the DNS cache on recent macOS versions, the most reliable method involves using the Terminal application. Terminal provides access to the Unix-based command-line interface of macOS, where you can execute the necessary commands. Launch Terminal from the Utilities folder within Applications, or use Spotlight Search to open it quickly. Once Terminal is open, enter the command sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder and press Return. You will be prompted to enter your system password, as these commands require administrative privileges. This combined command ensures that both the DNS cache and the multicast DNS responder are reset.
The dscacheutil -flushcache command clears the DNS cache handled by the Directory Services cache daemon, while killall -HUP mDNSResponder sends a hang-up signal to the mDNSResponder service, prompting it to restart and reload DNS settings. This combination effectively resets the system’s DNS resolution state, forcing all subsequent domain queries to be freshly resolved from the configured DNS servers.
In some older versions of macOS, like Mavericks (10.9) or earlier, the commands are slightly different. For example, Mavericks uses sudo killall -HUP mDNSResponder, while Lion (10.7) and Mountain Lion (10.8) rely on sudo killall -HUP mDNSResponderHelper. The underlying concept is the same: the DNS resolver service is restarted to clear out cached entries. For users running newer versions of macOS, however, the unified command approach covers all necessary components and simplifies the process.
After executing the command, there is typically no feedback or confirmation in Terminal, but the cache is flushed immediately. To verify the effect, you can run a DNS lookup using the dig or nslookup command for the domain in question, or simply revisit the website to check whether it now resolves correctly. If the problem persists, it’s worth verifying that the authoritative DNS records have fully propagated and that there are no other caching layers—such as browser or router-level caches—interfering with the resolution.
Flushing DNS cache is especially useful when working in development environments where changes to DNS records or hosts file entries are frequent. Developers and IT professionals often rely on this technique when switching between staging and production servers, testing DNS configurations, or validating propagation after making DNS updates. It is also a recommended step when troubleshooting connectivity issues, where incorrect or outdated DNS entries might be causing domains to point to invalid or unreachable servers.
In cloud and enterprise settings, where macOS machines may be managed via mobile device management (MDM) systems, administrators can script and automate DNS cache flushing across multiple systems using remote shell commands or configuration profiles. This ensures consistency in environments where accurate DNS resolution is critical, such as when rolling out updates, migrating infrastructure, or responding to DNS-based incidents.
In conclusion, knowing how to flush the DNS cache on macOS is a simple yet powerful troubleshooting tool that ensures your system accesses the most up-to-date DNS information available. While DNS propagation is largely out of a user’s control, local caching is not, and being able to reset the resolver state manually can save time, avoid confusion, and restore access to newly configured domains or services. Whether you’re managing your personal MacBook or overseeing a fleet of enterprise machines, understanding this process is an essential part of maintaining reliable network connectivity.
Flushing the DNS cache on macOS is a vital step when troubleshooting DNS-related issues, particularly during or after DNS propagation. When a domain’s DNS records are updated—such as switching to a new hosting provider, modifying mail server records, or pointing to a content delivery network—it may take time for the changes to be recognized across…