Skip to content

Instantly share code, notes, and snippets.

@donalod
Created September 14, 2022 14:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save donalod/a5a9524704d87d88af37c2c71fc3e748 to your computer and use it in GitHub Desktop.
Save donalod/a5a9524704d87d88af37c2c71fc3e748 to your computer and use it in GitHub Desktop.
localdns with dnsmasq installed on macOS
#!/usr/bin/env bash
# Assumes dnsmasq is available and you have 127.0.0.1 and ::1 configured at the top of your DNS settings in
# /etc/resolv.conf
# Also assumes you have previously provided the plist as per:
# sudo cp $(brew list dnsmasq | grep /homebrew.mxcl.dnsmasq.plist$) /Library/LaunchDaemons/
if [[ "$1" == "on" ]]; then
sudo launchctl load /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist
fi
if [[ "$1" == "off" ]]; then
sudo launchctl unload /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist
fi
dscacheutil -flushcache
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment