-- Linux, Mac OS X, Python

Setting up a wildcard DNS domain on Mac OS X

Setting up a wildcard DNS domain on Mac OS X

There are many ways to develop on a Mac, and many stack to choose from. One common and recurring need however is to access your local websites through a named domain, ie using example.dev. Thankfully, there is a really simple way to do this using Dnsmasq as a local resolver.

Install Dnsmasq

This is straightforward with Homebrew:

Configure Mac OS X

All we need to do is tell the resolver to use Dnsmasq for .dev domains:

 

You can now use any .dev domain and it will always resolve to 127.0.0.1:

 

Conclusion

This is very useful in particular for applications that use subdomains as account identifier: you can easily create new accounts on the fly, and never have to worry about your /etc/hosts file again.

Finally, you may also want to look at Pow (and powder). Pow will automatically start your Rails/Rack applications, and provides a port proxying feature for apps written in other languages. Definitely a great alternative.

That’s it for today.

Cheers!

342 Total 1 Today