The Domain Name System (DNS) acts as the phonebook of the internet. When you type a website address like digitash.com into your browser, DNS translates that human-readable name into the complex numerical IP address required to load the site. To speed up your web browsing, macOS saves (or “caches”) these IP addresses locally.
However, if a website recently migrated to a new server or if your local DNS cache becomes corrupted, your Mac might stubbornly try to connect to the old, invalid IP address. The result is a frustrating “Server Not Found” or “This site can’t be reached” error, even when the website works perfectly on your phone. To fix this, you must clear (or “flush”) the DNS cache, forcing your Mac to fetch fresh data.
How to Flush the DNS Cache Using the macOS Terminal
Unlike Windows, macOS does not provide a simple button in the System Settings to clear your DNS cache. Instead, you must run a specific command using the built-in Terminal application. The exact command depends entirely on which version of macOS your computer is currently running.
Step 1: Check Your macOS Version
Before proceeding, you must verify your operating system version to ensure you use the correct command.
- Click the Apple Logo in the top-left corner of your screen.
- Select About This Mac from the dropdown menu.
- A small window will appear displaying your macOS version (e.g., macOS Sonoma, macOS Ventura, or macOS Monterey). Make a note of this.
Step 2: Open the Terminal Application
- Press Command + Spacebar on your keyboard to open Spotlight Search.
- Type Terminal and press Return.
- A small window with a command prompt (usually ending with a
%or$symbol) will open.
Step 3: Enter the Correct DNS Flush Command
Copy and paste the appropriate command for your macOS version into the Terminal window. You will be prompted to enter your Mac’s administrator password. (Note: When you type your password in the Terminal, no characters or asterisks will appear on the screen. This is normal security behaviour. Just type it and press Return.)
For macOS Sierra (10.12) through macOS Sonoma (14.x) and newer:
Apple has consistently used the mDNSResponder process for DNS caching over the last several major releases. Use this command:
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
For OS X El Capitan (10.11) and OS X Yosemite (10.10.4 and newer):
Use this command:
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
(Yes, this is identical to the modern command, but it is important to confirm it works for these older versions).
For OS X Yosemite (10.10.0 to 10.10.3):
Early versions of Yosemite briefly switched to a different DNS process called discoveryd. Use this command instead:
sudo discoveryutil mdnsflushcache; sudo discoveryutil udnsflushcaches
For OS X Mavericks (10.9) and OS X Mountain Lion (10.8):
Use this command:
sudo killall -HUP mDNSResponder
Step 4: Verify the DNS Flush Was Successful
The Terminal will not output a “Success” message after you run the command. It will simply return to a new line with your prompt. This silent return means the command executed perfectly.
To verify the fix, completely close your web browser (Safari, Chrome, or Firefox) by right-clicking its icon in the dock and selecting Quit. Reopen the browser and attempt to navigate to the website that was previously failing. If a corrupted DNS cache was the culprit, the site will now load instantly.