CertMon

NETWORKING & DNS

How to configure /etc/resolver for .test domains on macOS

Editing /etc/hosts for every new local service gets old quickly, and wildcards (*.test) are not supported by the hosts file. Here is how macOS domain-specific DNS resolvers solve it.

Start in Terminal: Setting up /etc/resolver

macOS has a unique feature: any file in /etc/resolver/<domain> directs DNS queries for that domain to a custom nameserver port.

# 1. Create the resolver directory (requires root once)
sudo mkdir -p /etc/resolver

# 2. Add resolver config pointing *.test to a local DNS responder on port 2053
sudo tee /etc/resolver/test <<EOF
nameserver 127.0.0.1
port 2053
EOF

# 3. Flush macOS DNS cache to activate immediately
sudo dscacheutil -flushcache
sudo killall -HUP mDNSResponder

# 4. Verify resolution with scutil
scutil --dns | grep -A 5 "resolver #.*(domain: test)"

Why /etc/resolver is better than /etc/hosts

The native way with CertMon

CertMon manages the /etc/resolver/test file through its privileged helper daemon and runs a tiny, non-blocking UDP DNS server on 127.0.0.1:2053 in-process.

Any .test domain you type in your browser instantly resolves to 127.0.0.1 with zero configuration and zero manual terminal edits.

CertMon routes all .test domains automatically using macOS resolver.
CertMon automates /etc/resolver/test and answers DNS queries on 127.0.0.1:2053.

Download CertMon free trial

Related guides