This short article describes how to flush (or reset) the DNS cache. DNS queries (ip addresses) are usually cached but sometimes it may be necessary to flush / clear the cache. Clearing (or “flushing”) cache will refresh this data. For instance, If you experience a lot of 404 (cannot find server) error codes, you may want to reset your DNS cache. This process is really easy.
Here is how you can clear DNS cache in different Mac OS X versions:
OS X 10.10 Yosemite
Open Terminal and enter the following command. This will clear MDNS and UDNS caches.
sudo discoveryutil mdnsflushcache;sudo discoveryutil udnsflushcaches
OS X 10.9 Mavericks
Open Terminal and enter:
dscacheutil -flushcache;sudo killall -HUP mDNSResponder
OS X Mountain Lion or Lion (10.7 and 10.8)
Launch the Terminal app (Applications > Utilities > Terminal) and enter (you will be required to enter your admin password):
sudo killall -HUP mDNSResponder
Mac OS X 10.6 and 10.5
Open Terminal and type:
sudo dscacheutil -flushcache
Mac OSX 10.4 And Below
Launch Terminal and enter: