How to Flush the DNS Cache on Your Mac | How To
Whenever an Internet connection issue occurs, the first thing that is going to be blamed is the internet browser, even though there are plenty of reasons that can cause issues in your connection. For instance, the DNS cache stored on your machine could be old and not able to retrieve the required websites for you. If that's the case, you may need to flush it.
Flushing the DNS cache on a mac running macOS is as easy as running a command through the Terminal window. All you need to do is launch the Terminal app and enter a command, and it will get the job done for you.
Flush DNS Cache on Mac
1. Click on Launchpad in your dock, search for and click on Terminal, and it will launch for you.
2. When Terminal launches, type in the following command and press Enter. The command flushes the DNS cache on your machine.
3. Since you are executing a “sudo” command, you will be prompted to enter the admin password of your machine. Do so and press Enter to move forward.
4. Wait for your Mac to flush the DNS cache, and as soon as it is done, you will hear a message saying the cache has been flushed.
Instead of sending you a text notification saying the cache has been flushed, Terminal will tell you (of course, in machine language) that the said data was flushed.
Now that your DNS cache has been wiped, go ahead and open a website in a browser, and you should notice that it now properly resolves, and you are able to access it. If that happened, the trick worked for you.
Also, the above command should only work for Mac users that run OS X El Capitan or later. If you happen to be on an older version of macOS, the above command will not work, as there has been some internal changes in the OS files, thus making these commands invalid. However, a little Googling should definitely land you on a page telling you how you can flush the DNS cache on OS X Yosemite or any older versions.
If the DNS cache stored on your Mac is causing issues, the above guide should help you get rid of the issue by helping you wipe the entire DNS cache stored on your Mac.