How to Reset DNS Cache in macOS High Sierra
Need to reset and clear DNS cache in macOS High Sierra? Some Mac users may need to occasionally reset their local DNS cache, typically because the Mac DNS settings have changed, or a particular name server or domain is cached and they need to flush existing DNS cache.
While it’s most often web developers, systems administrators, and network admins that fiddle with DNS and have to reset and clear their DNS caches, sometimes other Mac users need to clear the DNS caches as well.
In macOS High Sierra, you can reset DNS cache by targeting the mDNSResponder process via the command line available in Terminal app. This is similar to clearing DNS cache in macOS Sierra and El Capitan, though the process to reset DNS cache has changed many times throughout the history of the Mac OS and Mac OS X operating system.
How to Reset DNS Cache in MacOS High Sierra
Note that resetting and flushing DNS cache will likely interrupt any active internet activity or usage.
- Launch the Terminal application, it is found within the /Applications/Utilities/ folder on a Mac
- At the command line, enter the following syntax:
- Hit the Return key and then enter the administrator password, then hit return again
- Wait a moment, when you see the text “macOS DNS Cache Reset” appear in Terminal the DNS cache reset has been successful
- Exit Terminal
sudo killall -HUP mDNSResponder; sleep 2; echo macOS DNS Cache Reset | say
You may need to quit and relaunch certain internet connected applications for the changes to take effect, though most web browsers can suffice with a simple refresh.
If the above approach doesn’t work for whatever reason, you can break the command syntax down into smaller components:
sudo killall -HUP mDNSResponder && echo macOS DNS Cache Reset
This applies for macOS High Sierra, which is versioned as Mac OS 10.13.x. Users interested in learning how to reset DNS cache in prior versions of MacOS can learn how to do so for Sierra, El Capitan, Yosemite, and earlier versions of Mac OS X if desired.
Make short you are only copying the words (or letters), the command does not like extra spaces at start or Finnish of it .
My DNS gets changed everytime I connect to internet. The DNS is invalid and I usually clear it DNS Server tab everytime. Can anyone help me on this
Thank You!
(For the Complainers.. see above, this is where your post should end! on this page and all others you were offered a solution to YOUR question/s)
Knowledge is power, one day you will use this “say” command doesn’t matter when/why be thankful for the shared knowledge.
Thankyou so much! This was my third attempt at finding a script that would work in High Sierra.
I was actually appreciative of the voice result. In previous versions of this type of code, apparently there was no visible success line. So I knew it had worked here. I don’t know why people are complaining instead of being grateful for your help. We seem to be living within a Culture of Complaint…. Again, many thanks!
Why the ridiculous sleep then a say command. Literally 2/3 of that command is redundant. I wanted to know how to clear my DNS cache, not perform some stupid party trick.
Why the `say` command? Thats dumb, you don’t need to add stupid things that are funny.
that aren’t* funny
The command is meant to clear the DNS cache and reset DNS cache in macOS HIgh Sierra, it is not meant to be funny or not funny.
sudo killall -HUP mDNSResponder; sleep 2; echo macOS DNS Cache Reset | say
The command as written will reset the DNS cache in High Sierra, and when it is complete the command will report back when the DNS cache reset was successful.
Another option to reset the DNS cache in macOS High Sierra is this command:
sudo killall -HUP mDNSResponder; echo macOS-DNS-Cache-Clear
I don’t understand the hubbub but a lot of people don’t understand how the command line works so that’s probably why they’re confused.
This is what happens when I input above command (I copied and pasted to be sure it was correct)
sudo: command not found
sleep: command not found
say:command not found
Any ideas?
Thanks,
R
Wow! that’s incredibly handy! I had no idea I could make my Mac talk!
echo that was stupid | say
I don’t understand why you would want your machine to “say” it’s flushed the dns??
The command is the same in Sierra and High Sierra.