Created
September 14, 2022 14:59
-
-
Save donalod/a5a9524704d87d88af37c2c71fc3e748 to your computer and use it in GitHub Desktop.
localdns with dnsmasq installed on macOS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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