Apple has provided some related documentation here. In which they recommend avoiding
.local if you can and instead using a suffix such as
.local should be avoided is because it's used by the Bonjour service.
Add the following Search Domain as in the screenshot (you can disregard my DNS Server settings):
Another possibility is documented here in an article about using Dnsmasq for local development on OS X and a related StackOverflow question in which someone seems to have found it successful except when their offline (which doesn't make a lot of since.. but the key point here is, it seems to work for them at least part of the time)
The linked article directs that you should create a directory at
/etc/resolver if it doesn't already exist by using the command
sudo mkdir -p /etc/resolver
Now you should create a new file in this directory for each resolver you want to configure. Configure with at least these two options (there are more options available):
- the name of the resolver (corresponding to the domain name)
- the DNS server to be used.
For more information about these files, see the
resolver(5) manual page:
man 5 resolver
Create a new file with the same name as your new top-level domain in the
/etc/resolver/ directory and add a nameserver to it by running the following commands:
sudo tee /etc/resolver/local >/dev/null <<EOF
local is the top-level domain name configured to respond to and
127.0.0.1 is the IP address of the server to use.
I looked to see if I had that directory by default and I did not, but I did notice I had a file
/etc/resolv.conf which existed by default. I have not attempted, but if the solution in the article is unsuccessful I would try using this pre-existing
resolv.conf file.. under the assumption.. it must be there for a reason.