Hi, this is Gary with MacMost.com.
MacMost is brought to you by the more than 300 people that support it through its Patreon
Campaign.
Find out how you can become part of that at macmost.com/patreon.
So today let's take a look at flushing your DNS Cache.
Now, what is a DNS cache?
Well when you go to a website you usually type the name of the website like macmost.com
or apple.com.
DNS is a service where the name is then matched with a number, an address, which is usually
a series of four numbers that shows where the server is that has the information that
you want.
So while you may see names like macmost.com or apple.com actually what your browser wants
is a series of numbers.
DNS, domain name servers, are the way that the names are translated into numbers.
Now every time you go to a website it has to do that lookup.
It has to look up the name and see what the numbers are.
A DNS cache is basically going to keep that around so it doesn't have to do the lookup
every time.
After all when you go to a website, like perhaps a newspaper website say, and it has tons of
images and ads and all sorts of things.
There could be elements from all sorts of different domains there.
It may have to do a dozen or more lookups on different domain names.
So instead of doing a lookup every time it just remembers those and saves those in a
cache.
Now typically you never have to worry about DNS cache.
Everything will just work fine and that's true of most users most of the time.
However every once in awhile a domain name will update and your cache will be old.
This is particularly true if you're a developer and you're working with new websites that
are moving around in different servers and things like that.
So every once in awhile you have to flush the DNS cache.
So let's look at how to do that.
This can solve a variety of problems.
So you may end up in a situation where you're having an issue getting to certain websites.
Like say you can't get to a particular website anymore but other websites seem to work.
Sometimes flushing your DNS cache is the key to solving that.
In order to flush you need to go into the Terminal.
So I'm going to search for and look for Terminal and then I'm going to use this command.
Now if you search around and try to figure out how to flush your Mac DNS cache you're
going to come up with a bunch of different answers.
So I'm going to show you all the different answers because it really doesn't hurt to
try some of these.
The main one, especially if you're using Sierra, High Sierra, or Mojave is simply to use this
basic command here and it basically kills and restarts the DNS responder which will
then clear the cache.
This sudo in front of it is basically saying that in order to use this command you need
to enter your password.
So you have to have a regular Mac account, an Admin account, in other words and use your
admin password.
The same password you use to log into your Mac after you reboot it.
So I'm going to use this.
Then I'll enter my password and hit return and that's it!
In most cases, especially Sierra and newer, that's all you need to do.
Now your DNS cache has been flushed.
For good measure you may want to restart Safari and then see if the website you're having
trouble getting to now works.
Now there are some other commands you can use especially if you're using older versions
of Mac OS.
Different websites tell you different things.
Say if you're using Yosemite or El Capitan, you know, do this or that.
Always use this command.
This command here is one that is required for resetting DNS cache no matter what version
of Mac OS you're using as long as it's somewhat recent.
But also this one as well so you may want to try that.
Notice it doesn't ask me the password because I just entered it.
So it knows that.
There is a third command that sometimes, particularly for Yosemite, is needed.
Now notice how, even though I'm using Mojave, it was fine with all of those commands.
So it didn't really hurt for me to do all three of them.
Now that I've entered all three of them in I can be sure, 99% sure, that I've cleared
my DNS cache and I can try to see if my problem has been resolved.