Flush DNS on macOS Quickly

0 10

The fastest way to clear DNS cache on macOS, Windows, Linux computers and servers

DNS cache stores the locations (IP addresses) of web servers that contain web pages which you have recently viewed. If the location of the web server changes before the entry in your DNS cache updates, you can no longer access the site.

Sometimes, for various reasons, the cache becomes corrupt or out of date, or, to use a technical term, “messed up”. The symptoms vary, but the most common is that you can’t get to some web sites in your browser.

That’s when flushing the DNS cache sometimes helps. It forces your computer to empty the cache and forget everything it knows about DNS entries that it’s looked up previously. It has to start asking the DNS server for new and up-to-date information as you reference domains by name thereafter

Flushing DNS in Windows is very easy open command prompt known as CMD and run the following command

ipconfig /flushdns

The following command is for Linux distributions like CentOS

sudo /etc/init.d/nscd restart

This is for Ubuntu

sudo /etc/init.d/dns-clean

but in macOS there is no default command & the command differ for every macOS versions

to speed up this i have created a binary that clears dns cache, all you have to do is to download and copy flushdns binary to /usr/bin

Download FlushDNS Binary macOS, extract it in Downloads folder

cp ~/Downloads/flushdns /usr/bin && sudo chmod 755 /usr/bin/flushdns

after this you can simply run “sudo flushdns” to clear cache on macOS

You can manually clear DNS cache by using suitable command in the following methods

OS X Yosemite and later

Use the following Terminal command to reset the DNS cache in OS X v10.10.4 or later:

sudo killall -HUP mDNSResponder

Use the following Terminal command to reset the DNS cache in OS X v10.10 through v10.10.3:

sudo discoveryutil mdnsflushcache

OS X Mavericks, Mountain Lion, and Lion

Use the following Terminal command to reset the DNS cache in OS X v10.9.5 and earlier:

sudo killall -HUP mDNSResponder

Mac OS X Snow Leopard

Use the following Terminal command to reset the DNS cache in OS X v10.6 through v10.6.8:

sudo dscacheutil -flushcache

Leave A Reply