Skip to content

Instantly share code, notes, and snippets.

@juliangruber
Last active May 5, 2021 17:53
Show Gist options
  • Star 14 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save juliangruber/7356251 to your computer and use it in GitHub Desktop.
Save juliangruber/7356251 to your computer and use it in GitHub Desktop.
localhost subdomains on osx

First, install dnsmasq using brew:

$ brew update
$ brew install dnsmasq

Then create your configuration

$ echo "address=/localhost/127.0.0.1" > /usr/local/etc/dnsmasq.conf

Now add it to your start up items:

$ sudo cp -fv /usr/local/opt/dnsmasq/*.plist /Library/LaunchDaemons

And launch it:

$ sudo launchctl load /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist

Next tell OSX to use it:

Go to System Preferences -> Network -> Advanced -> DNS. Now remember the dns server you already have and add two entries: 127.0.0.1 and your former dns server. -> OK -> Apply.

And you're good to go!

@19h
Copy link

19h commented Nov 7, 2013

Comes in handy if you'd like to call a service with an identity to allow implicit identification: user2342432334234324.local :)

@TimHeckel
Copy link

Very very helpful. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment