-
-
Save arnissolle/36523cdcf5037d7942fa5273387aabc7 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
| # ---------------------- | |
| # installing dnsmasq and enable daemon | |
| # ---------------------- | |
| brew install dnsmasq | |
| sudo cp -v $(brew --prefix dnsmasq)/homebrew.mxcl.dnsmasq.plist /Library/LaunchDaemons | |
| # ---------------------- | |
| # adding resolver for test domain | |
| # ---------------------- | |
| [ -d /etc/resolver ] || sudo mkdir -v /etc/resolver | |
| sudo bash -c 'echo "nameserver 127.0.0.1" > /etc/resolver/test' | |
| # ---------------------- | |
| # configuring dnsmasq | |
| # ---------------------- | |
| sudo mkdir -p $(brew --prefix)/etc/ | |
| cat > $(brew --prefix)/etc/dnsmasq.conf <<-EOF | |
| listen-address=127.0.0.1 | |
| address=/.test/127.0.0.1 | |
| # keep nameserver order of resolv.conf | |
| strict-order | |
| EOF | |
| # ---------------------- | |
| # launching dnsmasq | |
| # ---------------------- | |
| sudo launchctl load -w /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment