Unable to access .dev domains

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)

Solution 1:

.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).