What is a DNS Cache?
A Domain Name Server (DNS) cache is nothing but a temporary database that maintained by the operating system your computer, It contains records of all the recent visits and attempted visits to any websites and other domains on the internet.
In other words, a DNS cache is just a temporary memory of recent DNS lookups that your computer or system can quickly refer to when it’s trying to figure out how to load a website. Most of the people only know the phrase “DNS cache” when it refers to flushing or clearing the DNS cache in order to help fix an internet connectivity issue.
Your system’s saved DNS cache stores the IP addresses(locations) of websites hosted servers (i.e web servers) that contain the web pages which you have recently viewed. In case there are changes in the location or IP address of the web server before the entry in your DNS cache updates, you can no longer access the site.
You may need to clear your DNS cache if you encounter a large number of HTML 404 error codes, After clearing your DNS cache, your system will query nameservers for the new DNS information.
Flushing your cache on Mac OS X
The commands to flush or clearing the DNS cache in OS X are quite different depending on the version of OS you are using. First, you just open your system’s terminal line interface or command prompt on your computer.
Once opened, run the command below that corresponds to your version of OS X.
OS X 12 (Sierra) and later
macbook$ sudo killall -HUP mDNSResponder;sudo killall mDNSResponderHelper;sudo dscacheutil -flushcache
OS X 11 (El Capitan) and OS X 12 (Sierra)
macbook$ sudo killall -HUP mDNSResponder
OS X 10.10 (Yosemite)
macbook$ sudo dscacheutil -flushcache;sudo killall -HUP mDNSResponder
Versions 10.10.1, 10.10.2, 10.10.3
macbook$ sudo discoveryutil udnsflushcaches