Creating a Local DNS Server for TLD Locally

Lately I’ve been finding the joys in the little things in my work life. I’ve been fortunate enough to be spending the last couple of days working on some internal tools that we’ve been using internally for the last year or so, and I’ve had the opportunity to grow. During this time however, I’ve found that not every developer does things the same way. Since working at TechSmith, I’ve always enjoyed how they did things there. It was a positive way of thinking about the web and how to handle Dev, Test, Staging and Production systems and creating a workflow that worked best after several years of iterations. One thing that stuck with me was how they handled those environments. Today what I wanted to share with you was an easy way to create a top level domain in a DNS server locally. It’s quite easy and you can have some fun with it.

This tutorial assumes the following:

  • You are running a Mac or Linux computer
  • You are familiar with the command-line, or can at least follow along copy/pasting things into it. 🙂
  • You want to use .dev for your top level domain. If you don’t you’ll just need to change .dev for .whatup or whatever you want to use.

Installing Homebrew

The first step to the process is making sure you have the right tools. You first need to get Homebrew installed. If you remember MacPorts, Homebrew is a fancier MacPorts. It’s great for installing programming languages and other useful tools. So to install Homebrew you need to open up your command-line tool (iTerm for me!) and type in the following:

ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"

This will install homebrew for you. Just a little background on Homebrew, it’s all git and ruby underneath. So in my former life, I lived in Ruby. So I still use a lot of it’s tools. They are great for just about any type of development.

What about the Magic?

At this point you may be asking yourself, so why did I just install Homebrew. Well the answer is quite simple! You needed Homebrew installed to install dnsmasq.

AJ Morris Avatar