Error Codes Wiki

Mac DNS Lookup Failed — Cannot Resolve Hostname Troubleshooting

Warningnetwork

About Mac DNS Lookup Failed

Fix Mac DNS lookup failures causing 'server not found', 'DNS lookup failed', and inability to load websites while other network services work. This guide covers everything you need to know about this topic, including common causes, step-by-step solutions, and answers to frequently asked questions.

Here are the key things to understand: macOS uses mDNSResponder for DNS resolution, which can crash or become corrupted. DNS issues on Mac can coexist with working IP-level connectivity (ping by IP works but names fail). VPN software frequently modifies DNS settings and may not restore them properly. macOS stores DNS settings per-network interface, and wrong settings can persist across networks. /etc/resolv.conf on Mac is auto-generated — manual edits are overwritten. Understanding these fundamentals will help you diagnose and resolve this issue more effectively.

The most common reasons this occurs include: mDNSResponder service crashed or hung. DNS servers configured in network settings are unreachable. VPN modified DNS settings and did not restore them after disconnecting. Wi-Fi network providing broken DNS server via DHCP. macOS DNS cache corrupted with stale or incorrect entries. Identifying the root cause is the first step toward finding the right solution.

To resolve this, follow these recommended steps: Flush DNS cache: sudo dscacheutil -flushcache && sudo killall -HUP mDNSResponder. Check DNS settings: System Settings > Wi-Fi > Details > DNS — ensure valid servers listed. Set manual DNS: add 8.8.8.8 and 1.1.1.1 in DNS settings for your network. Test resolution: nslookup google.com in Terminal — if it fails, DNS is the issue. Restart mDNSResponder: sudo killall mDNSResponder. If these steps do not resolve the issue, consider consulting additional resources or a qualified professional.

This article is part of our Mac Error Codes collection on Error Codes Wiki. We provide comprehensive, up-to-date information to help you find solutions quickly.

Quick Answer

Why can I ping by IP but not browse websites?

Your network connection works but DNS resolution is broken. DNS translates domain names to IPs. Set manual DNS servers to fix.

Overview

Fix Mac DNS lookup failures causing 'server not found', 'DNS lookup failed', and inability to load websites while other network services work.

Key Details

  • macOS uses mDNSResponder for DNS resolution, which can crash or become corrupted
  • DNS issues on Mac can coexist with working IP-level connectivity (ping by IP works but names fail)
  • VPN software frequently modifies DNS settings and may not restore them properly
  • macOS stores DNS settings per-network interface, and wrong settings can persist across networks
  • /etc/resolv.conf on Mac is auto-generated — manual edits are overwritten

Common Causes

  • mDNSResponder service crashed or hung
  • DNS servers configured in network settings are unreachable
  • VPN modified DNS settings and did not restore them after disconnecting
  • Wi-Fi network providing broken DNS server via DHCP
  • macOS DNS cache corrupted with stale or incorrect entries

Steps

  1. 1Flush DNS cache: sudo dscacheutil -flushcache && sudo killall -HUP mDNSResponder
  2. 2Check DNS settings: System Settings > Wi-Fi > Details > DNS — ensure valid servers listed
  3. 3Set manual DNS: add 8.8.8.8 and 1.1.1.1 in DNS settings for your network
  4. 4Test resolution: nslookup google.com in Terminal — if it fails, DNS is the issue
  5. 5Restart mDNSResponder: sudo killall mDNSResponder

Tags

macdnslookup-failedmdnsrespondernetwork

More in Network

Frequently Asked Questions

Your network connection works but DNS resolution is broken. DNS translates domain names to IPs. Set manual DNS servers to fix.