I was recently asked by a client to consolidate all of their DNS zone records and domain name registrations from 2 separate services to a single provider. The FAQ page of the current DNS service recommended using the named-xfer shell command, but that utility isn’t available on OS X. I googled around and learned that dig is a suitable alternative.

Finding the nameservers

Dig can be used to find nameserver information for a given domain:

Viewing and Backing up DNS Records

Backing these up just requires you to send that output to a file: dig @ns1.nameserver.com yourdomain.com IN ANY >> dns-backup-yourdomain.com-ns1.nameserver.com

Once you’ve updated the nameservers for a domain you can verify if they’ve changed using the dig yourdomain.com NS +short command.

Other useful dig commands