3

Kind of annoying. I use dev.*.com's locally in order to develop, but it seems like instead of respecting each domain I've defined in my /etc/hosts, my browsers are not able to reach out to any *.dev domain.

shopify.dev’s server IP address could not be found.

Things I've tried:

  • Switching browsers
  • Incognito windows
  • Restarting my machine
  • Verifying /etc/host doesn't have a greedy rule
  • Switched to Google's DNS 8.8.8.8
  • Flushing the Mac DNS cache

scutil -dns output:

DNS configuration

resolver #1
  nameserver[0] : 8.8.8.8
  flags    : Request A records
  reach    : 0x00000002 (Reachable)

resolver #2
  domain   : local
  options  : mdns
  timeout  : 5
  flags    : Request A records
  reach    : 0x00000000 (Not Reachable)
  order    : 300000

resolver #3
  domain   : 254.169.in-addr.arpa
  options  : mdns
  timeout  : 5
  flags    : Request A records
  reach    : 0x00000000 (Not Reachable)
  order    : 300200

resolver #4
  domain   : 8.e.f.ip6.arpa
  options  : mdns
  timeout  : 5
  flags    : Request A records
  reach    : 0x00000000 (Not Reachable)
  order    : 300400

resolver #5
  domain   : 9.e.f.ip6.arpa
  options  : mdns
  timeout  : 5
  flags    : Request A records
  reach    : 0x00000000 (Not Reachable)
  order    : 300600

resolver #6
  domain   : a.e.f.ip6.arpa
  options  : mdns
  timeout  : 5
  flags    : Request A records
  reach    : 0x00000000 (Not Reachable)
  order    : 300800

resolver #7
  domain   : b.e.f.ip6.arpa
  options  : mdns
  timeout  : 5
  flags    : Request A records
  reach    : 0x00000000 (Not Reachable)
  order    : 301000

resolver #8
  domain   : dev
  nameserver[0] : 127.0.0.1
  flags    : Request A records, Request AAAA records
  reach    : 0x00030002 (Reachable,Local Address,Directly Reachable Address)

DNS configuration (for scoped queries)

resolver #1
  nameserver[0] : 8.8.8.8
  if_index : 5 (en0)
  flags    : Scoped, Request A records
  reach    : 0x00000002 (Reachable)
8
  • 2
    Please add the output of scutil --dns, then check /etc/resolver ;-)
    – klanomath
    Commented Mar 31, 2020 at 17:26
  • Are you certain that you're typing the domain correctly? I just tested it and it's reachable. Can you do a dig shopify.dev and post the output to your question.
    – Allan
    Commented Mar 31, 2020 at 17:26
  • @klanomath added the scutil output to the comment. There's an "dev" entry to /etc/resolver. Could that be the issue? I've never seen this file before Commented Mar 31, 2020 at 17:33
  • @klanomath that's it! There's a dev directory in that directory that points back to 127.0.0.1. Some dev must've created that in some kind of script. Commented Mar 31, 2020 at 17:34
  • Sorry, I'm not sure what you mean by local dev domains - I develop with the dev.*.com pattern for local webservers. I think what happened was Laravel's Valet added this rule but didn't remove it on uninstall. Commented Mar 31, 2020 at 17:38

2 Answers 2

3

.dev is a regular top level domain name which became available to the general public on March 1, 2019. It's not recommended to use it locally for development purposes!


Depending on your development environment a required local name resolution is usually done either by adding (managing) hosts to (with) the /etc/hosts file or with a local nameserver like macOS Server's DNS server or tools like dnsmasq.

One common setup for local domains in e.g dnsmasq is a local resolution with the /etc/resolver/ method (example: Valet (Laravel): DNS address can not be found). By adding a file with the name of the tld (e.g. dev) containing the IP of a name server (e.g. nameserver 127.0.0.1) and setting up an appropriate configuration in the dnsmasq config file, the local DNS server will be authorative for this tld. All requests to resolve *.dev domains will be directed to this name server.

Other regular domains in the Internet with the same tld (e.g shopify.dev) won't be accesible then.


You can determine the various DNS resolvers in your system with the command scutil --dns.

A result like

...
resolver #8
  domain   : dev
  nameserver[0] : 127.0.0.1
  flags    : Request A records, Request AAAA records
  reach    : 0x00030002 (Reachable,Local Address,Directly Reachable Address)
...

is an obvious indication that the regular tld dev is directed to a local DNS server.

If you don't use the .dev domain anymore locally you can simply remove the file /etc/resolver/dev (and modifying the dnsmasq.conf file is recommended).

If you still rely on some .dev* tld move over to .develop or .development (and /etc/resolver/develop or /etc/resolver/development respectively).

1
  • 1
    Unfortunately, this is a bug/bad practice introduced by Laravel Valet. I haven't used it for years and thought I completely uninstalled it completely but it seems like removing the resolver wasn't in the uninstall directions/script. Lesson learned I guess. Commented Apr 5, 2020 at 13:43
1

klanomath's answer had clues for me. Problem in my setup was probably from an ancient pre-Valet or Homestead install or tutorial, there was a file migrated forward since 2016 in: Macintosh HD/private/etc/resolver directory with title dev and single line

nameserver 127.0.0.1

this presumably was (as described above) so local applications could have DNS resolved to domain.dev on localhost during local development, but now domain.test is more common convention these days (May 2023). That is because there is an external .dev TLD ( like splade.dev ) that we may still need to reach. All you need to do is change the name of the file from dev to test (leave contents untouched) and the local MacOS DNS resolver from terminal or any browser should work as expected for that external TLD.

Run Terminal command ~% scutil --dns

to verify results

MacOS Ventura 13.3.1 (a)

1
  • 1
    How is this any different from the existing, upvoted, and accepted answer? If the answer was helpful to you, please up vote the answer.
    – Allan
    Commented May 5, 2023 at 21:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .