How to Change DNS Server Settings in Mac OS X

Dec 5, 2015 - 17 Comments

Add and change DNS servers in Mac OS X

Having appropriate DNS settings is essential for a Mac to be able to successfully access internet domains, whether it be a website like https://osxdaily.com or a remote server. DNS, which stands for Domain Name Server, essentially translates numerical IP addresses to the readable domains that most internet users are familiar with, and thus without properly functioning DNS servers you often will encounter DNS lookup errors, or slower than expected access.

While most internet server providers offer their own DNS servers, and most Macs will use DNS from DHCP or a wi-fi router, Mac users sometimes wish to change DNS settings themselves to custom servers, perhaps for better performance, or for troubleshooting purposes. This is easily accomplished in MacOS and Mac OS X as we’ll detail in this walkthrough.

Adding, Editing, & Adjusting DNS Server Settings in Mac OS X

  1. Go to the  Apple menu and select “System Preferences”
  2. Choose the “Network” control panel, select your network interface from the left side (“Wi-Fi” or “Ethernet” for example), then click the “Advanced” button in the lower right corner of the Network window
  3. Accessing DNS settings in Network preference panel of Mac OS X

  4. Choose the “DNS” tab at the top of the screen
    • To add a new DNS server: click on the [+] plus button
    • To edit an existing DNS server: click twice on the DNS IP address you wish to change
    • To remove a DNS server: select a DNS server IP address and then click either the [-] minus button or hit the delete key

    Adding and changing DNS servers in Mac OS X

  5. When finished making changes to the DNS settings, click on the “OK” button
  6. Now click on “Apply” for the DNS changes to take effect, close out of System Preferences as usual

The topmost DNS servers will be accessed first, so you’ll want to put the best performing servers near the top of the list for best results. In the screen shot examples above, Google DNS servers (8.8.8.8 and 8.8.4.4) are placed above the OpenDNS servers, both of which are faster than ISP provided DNS servers as determined by NameBench for this network environment.

Depending on what you’re doing and why you’re modifying DNS settings, you may wish to flush DNS cache for the changes to take effect, this is particularly true with editing the hosts file. Mac users can clear DNS caches in OS X El Capitan and newer with this command, and for specific Yosemite versions with this command, and even earlier releases of OS X with this. Additionally, you may need to quit and relaunch some applications for the DNS changes to carry over to them.

Advanced Mac users can also adjust DNS from the command line in Mac OS X, though that approach is obviously a bit more technical than simply changing the settings through the Network preference panel. And of course, those on the mobile side of things can change DNS in iOS as well if need be.

.

Related articles:

Posted by: Paul Horowitz in Mac OS, Tips & Tricks

17 Comments

» Comments RSS Feed

  1. Pencil says:

    Why doesn’t the “add” button work

  2. pamela says:

    My DNS used to work just fine until I changed my mac’s SSD and then it stopped working. I’ve tried manually changing my DNS in network preferences>advanced, I’ve flushed my DNS, nothing works! Can you help?

  3. Mr Anonymous says:

    I’ve found this info alongside “how to flush” a thousand times… but I want to know is how to view and edit TTL of the DNS records on my Mac. Currently I’m paying for a DNS resolution based on queries per month and I want to increase the TTL of my cache. Does anyone know?

    • Jeff says:

      You don’t. The TTLs are attached to each record, and those are under control of the domain which serves those records.

      Those values are chosen by the originators for specific reasons, and often are reduced to short intervals when record changes are about to happen, so that updates are quickly recognized.

  4. ali says:

    why cant i press the add dns button?

  5. Harry Jesse says:

    Correct if you want to add DNS servers, click on the add button it looks like a cross or addition symbol.

  6. Carol says:

    Thank you Eduardo. I’ll try it that way. I guess I thought you could just add servers to the list and retain the originals, but evidently that isn’t the way it’s set up. I will copy them first before I attempt adding new ones. When I first tried adding Google DNS to my list through the plus sign, my current ISP server disappeared (and I hadn’t copied it down). I panicked a little until I saw the Revert button, which brought everything back the way it was.

    I’m assuming that there is also no easy way to rearrange the order without deleting and re-adding them. I admit I’m spoiled by so many programs that let you just click and drag items around. Thank you again.

    • Eduardo Stevens says:

      You can drag to re-arrange the DNS servers, so you can add them at any order and rearrange with drag and drop.

      Presumably your DNS Settings are clearing out when you go to add a new one because the existing DNS is coming from DHCP on the router, rather than being hard-set like they are with this walkthrough. Basically you’re overriding the DNS settings by adding new ones, which I do all the time so it’s not a bad thing, as long as you have functional DNS (which is why Google DNS, OpenDNS, etc, are preferable). ISP DNS is usually slower once you leave your home network and join a different ISP network at a friends house, for example.

  7. Bert Visscher says:

    I have the same question as Carol. Judging by the above screenshot it is possible to add DNS servers rather than replace them, but how do we do it?

    • Orange Rarster says:

      Click the plus button to add a DNS server

      The walkthrough shows you how to add a DNS server, did you read the article? This must be what working in tech support is like. “Did you read the manual?” ‘NO of course not!’ “OK well let me read the manual to you”

      • York says:

        Correct if you want to add DNS servers, click on the add button it looks like a cross or addition symbol. If you want to add more than one DNS server, click it, add one, click it again and add another, and so on.

        • Carol says:

          Thank you York for your reply. I do understand how to add a DNS server as the instructions are pretty clear. My question was a little different. I want to keep the DNS servers that are already there, but add Google DNS to the list. When I click the plus sign to add a DNS server, it wipes out my previous DNS server. Is there a way to add servers without deleting those that are already there. Thank you!

          • Eduardo Stevens says:

            The best thing to do for your situation is to copy the DNS servers that you see existing before you go to edit them, then add those and Google DNS separately with the add button (just paste the DNS you copied, then Google DNS). If Google DNS is faster, put those numbers first, so they get priority, then add your ISP DNS later.

  8. Ryq says:

    I find the instructions started off well, then it was if there were missing parts.

    I had no trouble adding the DNS servers.

    Then you suggested I flush out the DNS Cache “true with editing the hosts file. That article showed how to edit the Hosts file, but I’m not sure what we are to do.

    The article refers to three articles that are almost four years old before any of us heard the name of “El Capitan.” Is it still appropriate for 2016 and El Capitan? If these are correct, perhaps they might be edited and the new date added.

    More importantly, should I have edited the Hosts File? In your example you seem to add 0.0.0.0 yahoo.com and another. Do we add this, or should we add google since that’s the DNS file.

    Also, one of the articles refers to learning the caches of MDNS and UDNS. Should we do that when adding the google servers above?

    I’ve been getting these tips for about two weeks. Other ideas have been clear and helpful.

    • Clemson says:

      Ryq, here’s a good rule of thumb: If it’s not something you understand, it probably doesn’t apply to you. So you added some DNS, why? Who knows why you did, but you did and that’s great. Maybe you benchmarked faster servers. The rest is over your head? Then it doesn’t apply to your needs.

      Perfect example: If you don’t know why you’d edit the hosts file, you have no business editing the hosts file. It’s not for casual users.

      If you’re running OS X El Capitan, you use what is relevant to OS X El Capitan. And then you don’t need to worry about flushing DNS caches and mDNS/uDNS in earlier releases of OS X. Why worry about flushing cache in Mac OS X Snow Leopard if you’re on El Capitan? No point. If you drive a 2015 Ford and need to change your oil, do you care how someone is doing that differently with the 2004 model? No, of course not. Technology is the same.

  9. Wharf Xanadu says:

    I use google dns and it’s always the fastest. I have it set because wifi networks often don’t use good dns when you join them in the go.

  10. Carol says:

    I wanted to leave the Time Warner DNS but add Google’s DNS below it so if my cable goes out the computer would move down to Google. However when I click the plus sign it wipes out the current DNS instead of just adding additional ones. Is that how it’s designed to work or am I doing something I don’t need to. Thank you.

Leave a Reply

 

Shop on Amazon.com and help support OSXDaily!

Subscribe to OSXDaily

Subscribe to RSS Subscribe to Twitter Feed Follow on Facebook Subscribe to eMail Updates

Tips & Tricks

News

iPhone / iPad

Mac

Troubleshooting

Shop on Amazon to help support this site