Published on

How to Flush DNS Cache in macOS

Authors
  • avatar
    Name
    Robert Turner
    Twitter
    @rt3me

Introduction

If a domain is not resolving correctly in macOS you can try flushing the DNS cache. DNS can be cached, or saved at different points including your local machine, local network equipment, internet service provider, etc. When cached DNS information is being used to resolve domains to IP addresses, the latest DNS information may not be accessed, which could cause a domain to point to an old IP address. Flushing, or clearing, the DNS cache can help to resolve this issue.

Open terminal

With Spotlight: Click the Spotlight search button or press Command+space to search. Type 'Terminal' in Spotlight search. Double-click Terminal when it appears in the search.

With Finder: In Finder, navigate to Go > Utilities or click Applications > Utilities and double-click Terminal.

Enter command

When Terminal opens, enter the appropriate command for your version of macOS:

Big Sur and later:

sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder

El Capitan:

sudo killall -HUP mDNSResponder

Yosemite:

sudo discoveryutil udnsflushcaches

Mountain Lion and Mavericks:

sudo killall -HUP mDNSResponder

Snow Leopard:

sudo dscacheutil –flushcache

Leopard:

sudo lookupd –flushcache

Tiger:

use lookupd –flushcache

Sudo Password

Enter your macOS account password and press Enter to flush your DNS cache.