Join the other curious and interested readers of my Sunday letters. Sign up
Enjoy this piece? Get more like it every Sunday.Sign up

How to get .dev addresses on Mac OS X 10.10 Yosemite in 5 simple steps.

It's a really nice dream I've always put off as being too complicated - being able to open a browser and go to, and have things Just Work. Sure, I could use boxen, but after a year of running a team on boxen, it gets unwieldy and crufty, fast. No thanks.

Today, I finally bit the bullet and figured it out. To save you the trouble, here's how to set up nice hostnames on Mac OS 10.10, simply.

1. Install dnsmasq and nginx via homebrew.

brew install dnsmasq nginx

2. Configure dnsmasq.

echo "address=/dev/" > /usr/local/etc/dnsmasq.conf

3. Configure nginx.

Open up /usr/local/etc/nginx/nginx.conf in your favorite text editor, and for each of your sites, add something like this:

server {
    listen 80;
    location / {
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

for each of your projects. Change out the hostname and port as appropriate.

4. Set dnsmasq and nginx to load on startup, and start them now.

sudo cp -fv /usr/local/opt/dnsmasq/*.plist /Library/LaunchDaemons
sudo chown root /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist
sudo launchctl load /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist

sudo ln -sfv /usr/local/opt/nginx/*.plist ~/Library/LaunchAgents
sudo chmod 600  ~/Library/LaunchAgents/homebrew.mxcl.nginx.plist 
sudo chown root  ~/Library/LaunchAgents/homebrew.mxcl.nginx.plist
sudo launchctl load ~/Library/LaunchAgents/homebrew.mxcl.nginx.plist

5. Tell your system dns to handle .dev domains.

sudo mkdir -p /etc/resolver
sudo tee /etc/resolver/dev >/dev/null <<EOF

You're all set! You should now be able to browse to, and have it show up.

Shoulders of giants:

As with pretty much everything tech, this is a small contribution assembled on the shoulders of smart people. Credit where it's due:

Did this help you out? Help me out by subscribing to my letter. It's awesome, contains stories from my adventures living around the world, and people tell me it enriches their lives. :)

Nah, I hate curiousity.