Mac O’Clock
Published in

Mac O’Clock

How to Flush DNS Cache on macOS and Linux

Photo by Goran Ivos on Unsplash

macOS

  1. Open the terminal window.

If you’re using Mac OS Sierra, X El Capitan, X Mavericks, X Mountain Lion, or X Lion, enter the following command:

sudo killall -HUP mDNSResponder

  1. To flush DNS cache on Mac OS X Yosemite, enter the statement:

sudo discoveryutil udnsflushcaches

Linux

  1. Ubuntu does not cache DNS entries. However, if you have manually installed a DNS service, such as name service caching daemon then you can periodically flush the DNS cache. The method provided below will show you how you can flush your DNS cache.
  2. Press Ctrl+Alt+T together to open the terminal window.
  3. The next step is to enter the following command to clear DNS cache files on init.d subdirectory:

sudo /etc/init.d/nscd restart

--

--

The best stories for Apple owners and enthusiasts

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store