2022 Developer Survey is open! Take survey.

Hot answers tagged

69 votes
Accepted

OS X 10.10.1 /etc/hosts & /private/etc/hosts file is being ignored and not resolving

/private/etc/hosts seems to be working normally for me in Yosemite (version 10.10.1). It's not necessary to flush the cache or reset discoveryd (the DNS resolver in Yosemite); sudo fs_usage | grep ...
user avatar
24 votes
Accepted

discoveryutil: command not found

Since discoveryutil was replaced by its predecessor mDNSResponder in 10.10.4 use sudo killall -HUP mDNSResponder again (like in Lion/Mountain Lion/Mavericks) to flush the DNS cache.
user avatar
  • 63.8k
21 votes

OS X 10.10.1 /etc/hosts & /private/etc/hosts file is being ignored and not resolving

I have discovered another wrinkle with this issue. In order to fix the problem I was having, I had to ADD IPv6 style hosts file entries. It seems that Safari will overlook IPv4 entries IF you have ...
user avatar
  • 211
20 votes

DNS Resolution Fails for ping and curl, but not dig

Had this same issue. I think the local DNS cache had bad data from my previous testing. It was quickly fixed by: sudo killall -HUP mDNSResponder
user avatar
  • 517
20 votes
Accepted

DNS servers aren't specific to network?

How can I set up my DNS servers to be configured differently for each wireless network? Set and Change in Network Preferences You can set your own custom DNS settings on a location basis by defining ...
user avatar
  • 81.1k
19 votes
Accepted

Why is my hostname resolution taking so long?

I was able to fix this issue by explicitly setting the HostName using scutil to be the same value as LocalHostName: $ scutil --set HostName $(scutil --get LocalHostName) Now: $ sudo scutil --set ...
user avatar
  • 501
19 votes
Accepted

/etc/hosts will not update/refresh at all

Check your hosts file, because probably it's malformed. It should look similar to this one: ## # Host Database # # localhost is used to configure the loopback interface # when the system is booting. ...
user avatar
  • 63.8k
19 votes
Accepted

Flush cache of DNS on macOS Sierra & High Sierra

sudo dscacheutil -flushcache does nothing useful related to DNS cache entries - at least in non-LDAP environments and 10.9-10.13. sudo killall -HUP mDNSResponder sends a hang up to mDNSResponder, ...
user avatar
  • 63.8k
18 votes

Discoveryd Alternative to Replace mDNSResponder Argument?

Since 10.10.1, the simplest way to fix this is to add --AlwaysAppendSearchDomains to ProgramArguments in plist file /System/Library/LaunchDaemons/com.apple.discoveryd.plist Then restart com.apple....
user avatar
  • 181
18 votes
Accepted

How to find all devices (IP Address, Hostname, MAC Address) on local network?

If using a third-party utility is not an issue for you, then I recommend giving these a try: arp-scan (available via Homebrew) brew install arp-scan arp-scan --localnet fing (download and install ...
user avatar
  • 1,557
17 votes

/etc/hosts gets over written

For me it's in the file /etc/pulse-hosts.bak You have to edit this file to customize your hosts directives When you are going to reconnect/connect using the Pulse Secure VPN, it's going to merge ...
user avatar
17 votes

How to flush the DNS cache of Safari on macOS Mojave without restarting the system?

To clean DNS cache on macOS, the following command should be used. (commands used to clean caches seems to be different on different version of macOS) sudo killall -HUP mDNSResponder Clean the DNS ...
user avatar
  • 1,121
14 votes

/etc/hosts gets over written

If you are using Juno Pulse VPN client, /etc/hosts gets over-written by /etc/jnpr-pulse-hosts.bak
user avatar
  • 141
13 votes
Accepted

How to refuse DHCP Server to change my hostname?

It took a LOT of Googling and digging to get this, but I finally found a solution that works. DHCP overrides the LocalHostName system property, but not the HostName property. By default the HostName ...
user avatar
13 votes

IPv6 dns resolution on macOS High Sierra

This was a huge hassle to figure out, so I wrote up a little guide in hopes that others would find it helpful: How to convince macOS to do IPv6 DNS lookups when your only IPv6 address is via a VPN or ...
user avatar
  • 536
11 votes

What is the "wake for wifi network access" setting in energy preferences?

Unless you have a Apple-branded router or Time Capsule or a specially configured PC or Mac to act as the Bonjour Sleep Proxy Server, you should disable this, and save the energy. Even if you do have ...
user avatar
  • 113
11 votes

Device name on router is different than OS X hostname

There are three different hostnames that macOS/OS X uses: ComputerName HostName LocalHostName Each of these values can be found in /Library/Preferences/SystemConfiguration/preferences.plist ...
user avatar
  • 81.1k
11 votes

Cannot ping localhost: "unknown host" on Mac OS X El Captain

I have solved the problem by restoring my Hosts file (it was empty): But before, you have to check your hosts file. cat /etc/hosts If nothing is shown, that means your hosts file is empty. Then ...
user avatar
10 votes

Do /etc/resolver/ files work in Mountain Lion for DNS resolution?

Using resolver files is actually not the recommended way of doing that. Instead you should create DNS resolver with scutil. To see all DNS queries on interface en0, open a Terminal and run: sudo ...
user avatar
  • 648
10 votes
Accepted

Wipe all WiFi settings from MacBook

IIRC, there is a pretty simple way to do this! The first set of instructions in this link explains it pretty well, but in case the link breaks, here is the text from the site. The idea is to delete ...
user avatar
  • 3,459
10 votes
Accepted

What are all these tvOS services?

The services are: ._airplay._tcp.local This is a Bonjour advertisement for the network service that enables AirPlay of video content. I.e. this allows iOS devices to discover the Apple TV as a "...
user avatar
  • 65.1k
9 votes

List DNS servers in Mavericks

in OSX Mavericks (10.9 - actually 10.6.3 up, I believe) if you want to see the active DNS configuration: scutil --dns The -first- entry (resolver #1) is reportedly the active configuration...though ...
user avatar
  • 634
9 votes

Why is my hostname resolution taking so long?

I originally had the same issue, but eventually resolved it. I used to have: $ scutil --get HostName Michaels-Macbook-Pro $ scutil --get LocalHostName Michaels-Macbook-Pro $ time python -c 'import ...
user avatar
9 votes

How to force MacOS to regenerate /etc/resolv.conf file?

I found a solution today. Actually the file is not /etc/resolv.conf in mac OS. It is /var/run/resolv.conf So do this: sudo rm /etc/resolv.conf sudo ln -s /var/run/resolv.conf /etc/resolv.conf
user avatar
9 votes

iOS 11: How to change DNS settings for cellular/mobile data?

Build your own VPN using OpenVPN & easy-rsa on a digital ocean cloud server ($5/mo for cheapest VM & 2TB monthly transfer), configure VPN to tunnel/forward all traffic, set up Cloudflare 1.1.1....
user avatar
9 votes

dnsmasq not working oh Mac OS High Sierra

tl;dr make sure you start dnsmasq as root. To diagnose this problem, I used Console.app, and searched for dnsmasq. My first problem revealed in the logs: failed to create listening socket for 127.0....
user avatar
  • 211
8 votes
Accepted

Yosemite Cannot Resolve Domain Names

A long shot, but do you use a Bonjour account with Adium? https://trac.adium.im/ticket/16827 An update from the OP indicates this was the issue: Turns out the issue was leaving bonjour messaging ...
user avatar
  • 206
8 votes

DNS Resolution Fails for ping and curl, but not dig

dig on the one hand and curl/ping on the other hand are retrieving data from different hosts: dig queries a DNS server – in your case your localhost (127.0.0.1) – for a database entry: the IP address ...
user avatar
  • 63.8k
8 votes

How to force MacOS to regenerate /etc/resolv.conf file?

I guess, this file is created/updated when you change the network settings in 'System Preferences'. You need to 'System Preferences...' -> Network -> (select the active NIC device) In the Network ...
user avatar
  • 191
8 votes
Accepted

macOS, launchctl and dnsmasq for localhost domain spoofing

You've not said which version of MacOS you're on; my reply here is from macOS Sierra Version 10.12.5. (I'm using it in order to run tests against a VMWare installation of ADCS...) First, the commands ...
user avatar
  • 256

Only top scored, non community-wiki answers of a minimum length are eligible