I love playing with various OS’s and in OSX is on top of my list. During the day I am managing IT from my old trusted Lenovo ThinkPad with Windows. At night I am using my MacBook PRO. And I love it. The more and more I use it for various tasks the more I am looking for alternatives to Windows commands.
Manage and Report Active Directory, Exchange and Microsoft 365 with ManageEngine ADManager Plus. Download Free Trial!
Why would you flush DNS cache in the first place?
Whenever there is a change in DNS, for example you change IP ADDRESS of a website, DNS is still caching old entry. But when you flush it, all the records are gone, then DNS will have to query DNS again to obtain the latest address.
I was asked by my friend how to flush DNS in Mac OS X… I didn’t know, I admit. In the end it’s fairly easy.
Flush DNS in Mac OS X Snow Leopard 10.6
Open terminal and type:
this is quite similar to windows, instead of ipconfig /flushdns you type dscacheutil -flushdns
Flush DNS in OS X Lion (10.7) and OS X Mountain Lion (10.8)
With Lion, there is a bit more typing to do. Luckily same applies to Mountaion Lion as well.
sudo killall -HUP mDNSResponder
dscacheutil still works in 10.8 and 10.7 but official method is to kill mDNSResponder. As alternative you can kill process in Activity monitor.
Flush DNS in OS X 10.9 Mavericks
If you are running 10.9 version of OS X, you will have to type even more, by executing command below you will do two things: 1. You will flush cache 2. then you will reload DNS for changes to come in effect.
dscacheutil -flushcache;sudo killall -HUP mDNSResponder
How to clear DNS cache in OS X 10.10 Yosemite
To completely clear DNS cache in OS X 10.10, you will have to target MDNS – Multicast DNS and UDNS -Unicast DNS with two different commands but they can be merged in to one. Open terminal and type:
sudo discoveryutil mdnsflushcache;sudo discoveryutil udnsflushcaches;say flushed
You can also type each command separately.
In order to clear MDNS cache type in the following command:
sudo discoveryutil mdnsflushcache
In order to clear UDNS cache type in the terminal the following command:
sudo discoveryutil udnsflushcaches
Yes, it’s not a mistake, you have to use plural
How to clear IOS DNS cache
IOS does not have a terminal which you can use to type in commands like in OS X. One solution which will work on IOS is to restart the device. But in this case, it will take a lot of time.
What you can do is to enable and disable flight mode. Go to Settings, Airplane mode and turn it ON. Wait for several seconds and turn Flight mode OFF. This will clear DNS cache. In IOS version 7 and above, you can pull up new menu at the bottom (quick access) and press first icon on the left – flight mode. Wait for several seconds, and press it again to turn flight mode off. You can use this method to clear DNS cache on iPhone and iPad.
Leave a Reply