In Windows and Linux, clearing the cache is pretty straightforward. But in OS X, it's not quite that simple. Below is a guide on how to accomplish this.
1.) Open Terminal.
2.) For OS X v10.10.4 and above (Yosemite), you can run
and it'll reset the cache for you.
3.) For OS X v10.10 through 10.10.3 (Yosemite), use
4.) For OS X v10.9.5 and earlier (Mavericks, Mountain Lion, and Lion), use
5.) For OS X v10.5.2 through v10.6.8 (Snow Leopard), use
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
If you don't want to manually enter these commands, you can instead use a Bash script to accomplish this. Use the following script
and then you can use:
to flush the DNS. This code will fetch the latest bash script in case a new command is needed in future releases of OS X to flush the DNS.
1.) Open Terminal.
2.) For OS X v10.10.4 and above (Yosemite), you can run
Code:
killall -HUP mDNSResponder
and it'll reset the cache for you.
3.) For OS X v10.10 through 10.10.3 (Yosemite), use
Code:
discoveryutil mdnsflushcache
4.) For OS X v10.9.5 and earlier (Mavericks, Mountain Lion, and Lion), use
Code:
killall -HUP mDNSResponder
5.) For OS X v10.5.2 through v10.6.8 (Snow Leopard), use
Code:
dscacheutil -flushcache
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
If you don't want to manually enter these commands, you can instead use a Bash script to accomplish this. Use the following script
Code:
alias flushdns="curl -Ls 'https://raw.githubusercontent.com/OwlReporter/OwlMac/master/Scripts/FlushDNS.sh' | sudo sh"
and then you can use:
Code:
flushdns
to flush the DNS. This code will fetch the latest bash script in case a new command is needed in future releases of OS X to flush the DNS.