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.
There have been many times when I have faced DNS issues in my connection, and even changing them to alternative ones did not help. At such times what you are recommended to do is clear the DNS cache on your machine so that all of the websites that you visit are freshly resolved. That way the server will re-fetch the data for these websites and not load anything from your machine to ensure an issue-free Internet session for you.
Getting the DNS cache cleared on a Mac running OS X El Capitan 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.
Wiping the DNS Cache on a 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 clears the DNS cache on your machine.
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder; say DNS cache flushed
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 clear the DNS cache, and as soon as it is done, you will hear a message saying the cache has been cleared.
Instead of sending you a text notification saying the cache has been cleared, Terminal will tell you (of course, in machine language) that the said data was cleared.
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. If you happen to be on an older version of the OS X, 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 clear 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 off the entire DNS cache stored on your Mac.