Setup DNS-over-https in Mac OSX

Installation

// Download Doh-Client
git clone https://github.com/m13253/dns-over-https.git

// cd dns-over-https folder
cd dns-over-https

// makefile
make

// config your upstream server 
sudo nano /usr/local/etc/dns-over-https/doh-client.conf

// start service
sudo launchctl load -w /Library/LaunchDaemons/doh-client.plist

// stop service 
sudo launchctl unload /Library/LaunchDaemons/doh-client.plist

Using caddy server as https proxy

//download caddy
https://caddyserver.com/download

// build caddy service

nano /etc/systemd/system/caddy.service 

[Unit]
Description=Caddy server
Wants=network-online.target
After=network.target network-online.target
[Service]
AmbientCapabilities=CAP_NET_BIND_SERVICE
ExecStart=/etc/caddy/caddy -conf /etc/caddy/Caddyfile
Restart=always
RestartSec=3
Type=simple
User=root
[Install]
WantedBy=multi-user.target

// enable auto start
systemctl enable caddy.service

// start the service 
systemctl start caddy.service
// Change local dns with sudo
sudo -s
networksetup -getdnsservers Wi-Fi // return current dns 
networksetup -setdnsservers Wi-Fi 127.0.0.1 // only localhost
networksetup -setdnsservers Wi-Fi 127.0.0.1 1.0.0.1 // localhost + cloudflare dns

Reference: https://scotthelme.co.uk/securing-dns-across-all-of-my-devices-with-pihole-dns-over-https-1-1-1-1/

https://www.ookangzheng.com/wp-content/uploads/2018/06/com.okz_.dns_.plist_.zip
Download a sample start plist