To deal with the problem you have to clear your local DNS cache by performing a procedure called DNS flushing and in this post you will be guided on how to clear local DNS cache on several OS X versions which are Yosemite (OS X 10.10), Mavericks (OS X 10.9), Mountain Lion (OS X 10.8), Lion (OS X 10.7), Snow Leopard (OS X 10.6) and Leopard (OS X 10.5) . And I just hope your version is one of them, so you can take benefit from this post.
DNS is can be your good friend yet at the same time your enemy, in a case of DNS problem your computer may not be able to access web sites. Most of the connection problems on the connected computer is related to DNS, people will immediately relate the issue to it.
First thing we need to do before dropping the blame on DNS in case of connection problem is by performing a ping. Just ping to site you are unable to visit by posing ping command on the command prompt or other provided media (see the WikiHow tutorial regarding this matter).
After the pinging procedure done and you are still unable to connect to a site albeit the site is live, then the problem is your DNS. In that case you need to commit the following actions.
How to clear the local DNS cache on Yosemite, Mavericks, Mountain Lion, Lion, Snow Leopard and Leopard.
sudo discoveryutil udnsflushcachesOSX 10.9
dscacheutil -flushcache; sudo killall -HUP mDNSResponderOSX 10.7 – 10.8
sudo killall -HUP mDNSResponderOSX 10.5 – 10.6
sudo dscacheutil -flushcache
Now you have clear your Mac OS X local DNS cache to further test whether it works is simply visit a website that you previously were unable to access. If this time the website is opened then you did it.