Gem Version Dependency Status Build Status Code Climate Coverage Status

A small DNS server to enable local .dev domain resolution.


DevDNSd is a small DNS server which add a resolver to the system only for single TLD (by default, .dev). This way you can access your local application by typing every kind of url, i.e.

Of course, DevDNSd is inspired by pow, but it only provides DNS features, delegating the setup of a web-server to the user.

Basic usage

  1. Install the gem:

    gem install devdnsd

  2. Install the service:

    devdnsd install

You’re done!

Dual stack (IPv4/IPv6) usage

If you experience slowness in resolving host from clients (Chrome, curl etc.) when you don’t specify the address type, make sure you have both a A and AAAA rules set for the same host, like this:

ruby config.add_rule(match: /\.dev$/, reply: "") config.add_rule(match: /\.dev$/, reply: "::1", type: :AAAA)

Advanced usage

Just type devdnsd help and you’ll see all available options.


By defaults, DevDNSd uses a configuration file in ~/.devdnsd/default.conf, but you can change the path using the --config switch.

The file is a plain Ruby file with a single config object that supports the following directives.


DevDNSd has a nice rules system for matching name. You can add rules by calling config.add_rule(...) into the configuration file.

The first argument of the function is the name you want to match. You can use regular expressions and this is highly recommended if you want to pass a block to the method (see below).

The second argument should be the IP associated to the name. If the first argument is a regexp with groups, you can use the standard Ruby String#gsub substitution syntax for the reply. You can also use false to reject matching for this nameserver. In this case the next nameserver for the system will be used. You can skip this argument if you pass a block to the function. If you return nil from the block, then you’ll be responsible to set the response via the transaction variable.

The third argument can optionally be the record type for the resolv. By default is :A. This argument is ignored if you pass the block, as it assumes that the second argument is the record type.

If you pass a block to the method, its return code will be taken as the result of the resolving. So if you return false then the resolving will be rejected. The block takes three arguments, match, type and transaction. If you used regular expression for the first argument, then match will contain all the match information for the name.

For some examples of rules, see the config/devdnsd_config.sample file into the repository.


DevDNSd as a local resolver is tightly coupled with the OSX name resolution system, so it is only available for MacOSX.

You can, anyway, run the software as DNS server.

API Documentation

The API documentation can be found here.

Contributing to devdnsd

This software have been made possible by the awesome job of Samuel Williams, with his RubyDNS and process-daemon gems.

Copyright (C) 2013 and above Shogun (

Licensed under the MIT license, which can be found at