Skip to content

Instantly share code, notes, and snippets.

@com30n
Created September 15, 2020 09:25
Show Gist options
  • Save com30n/29f0481a6bf7d4efd2fd31062712070f to your computer and use it in GitHub Desktop.
Save com30n/29f0481a6bf7d4efd2fd31062712070f to your computer and use it in GitHub Desktop.
#!/bin/bash
# Tanks to: https://gist.github.com/ogrrd/5831371
# Update your homebrew installation
brew up
# Install dnsmasq
brew install dnsmasq
mkdir -pv $(brew --prefix)/etc/
# Copy the default configuration file.
cat << EOF > $(brew --prefix)/etc/dnsmasq.conf
# cloudflared proxy-dns --upstream https://1.1.1.1/dns-query --upstream https://1.0.0.1/dns-query --port 5053
server=127.0.0.1#5053
no-resolv
listen-address=127.0.0.1
# keep nameserver order of resolv.conf
strict-order
EOF
# Copy the daemon configuration file into place.
sudo cp $(brew list dnsmasq | grep /homebrew.mxcl.dnsmasq.plist$) /Library/LaunchDaemons/
# Start Dnsmasq automatically.
sudo launchctl load -w /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist
# Start Dnsmasq.
sudo launchctl start /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment