DNS

DNS not resolving on a Mac

When DNS fails, the Mac cannot change a name such as apple.com into an IP address. The connection can work, but every site by name fails.

Applies to: macOS 13 Ventura and later for the System Settings steps. The Terminal commands work on all current macOS versions.Checked: 29 October 2026

Symptoms

  • Browsers show “server can't be found” or a similar error for many sites.
  • Terminal tools show “Could not resolve host” or “nodename nor servname provided”.
  • Apps that use IP addresses still work, but names do not.
  • The problem starts after you change networks, connect a VPN or set custom DNS servers.

Likely causes

  • No connection. The Mac has no working path to the internet, so DNS queries cannot go out.
  • Wrong or unreachable DNS servers. A DNS server that you typed in by hand can stop working, or it can be blocked on this network.
  • The router's DNS fails. Many networks send DNS to the router. If the router stops answering, names fail on every device.
  • A VPN, profile or filter changes DNS. VPNs, encrypted DNS profiles and content filters can send queries to other servers.
  • Old answers in the cache. The Mac keeps answers for some time. After a site moves, an old answer can fail.

How to check

  1. Make sure that the connection works. Send pings to an IP address, so that DNS is not used.

    ping -c 3 1.1.1.1
  2. Send pings to a name. If the IP address works and the name fails, DNS is the problem.

    ping -c 3 apple.com
  3. Ask the macOS resolver for a name. This uses the same path as most apps.

    dscacheutil -q host -a name apple.com

    Output The ip_address and ipv6_address lines. No lines means that the lookup failed.

  4. Show the DNS configuration that macOS uses now. The first resolver is the default one.

    scutil --dns
  5. Show the DNS servers that you set by hand on the Wi-Fi service.

    networksetup -getdnsservers Wi-Fi

    Output A list of IP addresses, or a message that there are no DNS servers set. Then the network gives the servers.

How to fix it

  1. Remove DNS servers that you typed in by hand. Choose Apple menu > System Settings > Network.

  2. Click the network service, click Details, then click DNS. Select each server that you added and click the Remove button.

  3. You can also clear them in Terminal. Use the word empty in place of the server addresses.

    networksetup -setdnsservers Wi-Fi empty

    Needs an administrator password.

  4. Clear the DNS cache. See Flush the DNS cache on a Mac.

    sudo killall -HUP mDNSResponder

    Needs an administrator password.

  5. Get a new address and new DNS servers from the router. See Renew the DHCP lease on a Mac.

  6. Disconnect the VPN for a test. If names then work, examine the VPN's DNS settings. See DNS queries go outside the VPN on a Mac.

  7. If DNS fails on all devices, restart the router.

With Kilobat

  1. Kilobat measures one DNS lookup and lists the resolvers in use. Look at dnsMilliseconds, dnsServers and captivePortal.

    kilobat diagnose --json
  2. For one site or API, find the layer that fails. It checks DNS before the connection.

    kilobat why api.example.com
  3. The CLI is free. In the app, the Health tab shows the DNS servers and the lookup time. See Find why one site or API won't connect.

Questions

Why does ping to 1.1.1.1 work but sites fail?

A ping to an IP address does not use DNS. If it works and names fail, the problem is DNS, not the connection.

Why does dig work when apps fail?

dig sends queries to the servers in /etc/resolv.conf. Apps use the macOS resolver, which can also use VPN and per-domain rules.

Will the router give me DNS servers again?

Yes. When the DNS list in Network settings is empty, macOS uses the servers that the network gives by DHCP.

Sources

Sources checked on 29 October 2026. Man pages are the ones installed with macOS; open one with man <name> in Terminal.