There is a easy way to install DNSCrypt Proxy on macOS, make sure you have Homebrew installed.
Step 1. Install dnscrypt-proxy
by Homebrew:
brew install dnscrypt-proxy
Step 2. Choose one or more DNS Servers you need on this map. I chosen alidns-doh
for myself.
Step 3. Configure and Startup
- Edit config file
/usr/local/etc/dnscrypt-proxy.toml
with your favorite editor
# Backup config file if you need
sudo cp /usr/local/etc/dnscrypt-proxy.toml /usr/local/etc/dnscrypt-proxy-backup.toml
nvim /usr/local/etc/dnscrypt-proxy.toml
- Uncomment or add following content in config file.
# The DNS Servers you chosen
server_names = ['alidns-doh']
# Both IPv4 and IPv6 for me
listen_addresses = ['127.0.0.1:53', '[::1]:53']
- Start
dnscrypt-proxy
immediately and register it to launch at login (or boot).
sudo brew services start dnscrypt-proxy
- Change macOS DNS settings
System Preferences > Network > Wi-Fi or Ethernet > Advanced > DNS > + > enter '127.0.0.1' > OK > Apply
Step 4. Testing
nslookup example.com
dig example.com