Last active
February 8, 2021 16:05
-
-
Save JimmyRittenborg/f66498780d5a64551b90bc3aa5e0e4e1 to your computer and use it in GitHub Desktop.
Hot to use dnsmasq to resolve to all your local *.dev sites on macOS
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
#!/bin/bash | |
if test ! $(which brew); then | |
echo "Installing homebrew" | |
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" | |
fi | |
echo -e "\n\nChecking for brew updates..." | |
echo "==============================" | |
brew update | |
echo -e "\n\nInstalling and configuring dnsmasq..." | |
echo "==============================" | |
brew install dnsmasq | |
# To have launchd start dnsmasq now and restart at startup: | |
sudo brew services start dnsmasq | |
# Configure dnsmasq | |
sudo tee /usr/local/etc/dnsmasq.conf >/dev/null <<EOF | |
address=/.dev/127.0.0.1 | |
EOF | |
# Have MacOS resolve .dev at our dnsmasq nameserver ar 127.0.0.1 | |
sudo tee /etc/resolver/dev >/dev/null <<EOF | |
nameserver 127.0.0.1 | |
EOF | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment