You may occasionally get into a situation where the DNS on your Mac needs to be flushed from the system in order for a new server or some other DNS address change to be recognized by your computer.
Usually you don't need to worry about this unless you're a systems/network administrator or if you're a web developer, but there may be other network issues that can be solved with a simple DNS cache flush. In those situations, you can use the command in this how-to without even having to restart your Mac.
With almost every iteration of OS X, the command has changed to flush the DNS cache. In this article, we'll show you how to clear the DNS cache in OS X Yosemite (10.10). The old "mDNSResponder" command no longer works since Yosemite has a new system that manages the DNS cache.
Reset MDNS Cache (Multicast DNS)
OS X utilizes two DNS cache systems; the first is a MDNS Cache (or Multicast DNS) that handles the zero configuration services on your local network. To reset the MDNS cache, open the Terminal (located in Aplications/Utilities) and type the following command, followed by the return key:
sudo discoveryutil mdnsflushcache
If you are prompted for a password, simply enter it, then press return again.
Reset UDNS Cache (Unicast DNS)
The second DNS cache is called UDNS (or Unicast DNS), which handles associations between the network addresses and the network endpoints. To reset this cache, open the Terminal, then enter the following command:
Get the best Black Friday deals direct to your inbox, plus news, reviews, and more.
Sign up to be the first to know about unmissable Black Friday deals on top tech, plus get all your favorite TechRadar content.
sudo discoveryutil udnsflushcaches
Again, you may be prompted for a password. If so, enter it, then press return.
Reset Both Caches at Once
If you wish to reset all DNS caches in OS X Yosemite at once, then simply join the commands together with a semicolon, then paste them into Terminal like this:
sudo discoveryutil mdnsflushcache; sudo discoveryutil udnsflushcaches
After you've typed the command on a single line, all you have to do is press enter to flush both cache systems in OS X.