Every time you venture onto the Internet DNS resolutions are being made and your computer stores many of them.
Eventually, there will come a time when a bad entry is stored. There are generally two ways to remove these entries. First is to allow 24 hours to pass. During such time your computer will seek out and make the necessary DNS updates. Second would be to flush your DNS.
The following guide will walk you through flushing your DNS cache.
The first step to flushing your DNS, is to open Terminal. In Mac you can do this when you go to your Application folder, then Terminal.
Once in Terminal enter in the the line below depending on your OS X version.
OS X Yosemite v10.10.4:
sudo killall -HUP mDNSResponder
OS X Yosemite v10.10 through v10.10.3:
sudo discoveryutil mdnsflushcache
OS X Mavericks, Mountain Lion and Lion:
sudo killall -HUP mDNSResponder
OS X v10.6:
sudo dscacheutil -flushcache
macOS Big Sur/Monterey: sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
Once submitted you will need to enter in your computer’s password and the DNS cache will be cleared.
This video will show you how to clear your DNS cache on Mac.