Last active
August 29, 2015 14:20
-
-
Save dave-malone/a70ec53c8e7b523a75fc to your computer and use it in GitHub Desktop.
.local domain names on OS X
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
OS X has issues with any domain ending in .local. This can't be fixed by adding a value in | |
/etc/hosts because while the ping utility and other cli utilities use /etc/hosts first, as | |
expected, other applications on OS X do not. | |
In order to get around this problem, the DNS entry could be changed, and probably should be | |
so that anyone else using OS X who is trying to access this domain won't have to struggle through | |
this issue. | |
However, if the DNS entry for the service in question can not be changed, then you will need | |
to install a local DNS server and add a wildcard entry for .local domains to resolve to your | |
loopback address, and then add the necessary entry to /etc/hosts in order to get around this | |
issue. Here are the steps that I took on my own machine. | |
1. Install dnsmasq via Homebrew: | |
brew update | |
brew install dnsmasq | |
2. After installing dnsmasq, follow brew's instructions for configuring dnsmasq: | |
cp /usr/local/opt/dnsmasq/dnsmasq.conf.example /usr/local/etc/dnsmasq.conf | |
sudo cp -fv /usr/local/opt/dnsmasq/*.plist /Library/LaunchDaemons | |
sudo chown root /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist | |
3. Edit /usr/local/etc/dnsmasq.conf, adding a wildcard DNS entry for .local entries | |
4. Add your DNS entry to /etc/hosts | |
5. Finally, start dnsmasq: sudo launchctl load /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist |
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/local/etc/dnsmasq.conf | |
# the dnsmasq.conf.example file contains many lines of documentation and example configuration. | |
# that content has been omitted for brevity | |
address=/.local/127.0.0.1 |
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
# /etc/hosts file; usual contents omitted for brevity | |
# you .local domains in IPv4 format | |
10.10.10.10 <your-subdomain>.local |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment