Reached the point this evening where I got sick of editing /etc/hosts when doing local development on my MacBookPro.

I have learned enough lately configuring and installing BIND9, that I mustered up the courage to get it running on (theres no place like home).

Using this new fangled Google machine, I drummed up this tasty post.  OSX comes packaged with BIND (named is the daemon name), but it is disabled.  This post gets you setup and running.

The important thing I have to add to this topic, is that I could not for the life of me figure out what I added my local zone file called mysite.local (versus for a production BIND DNS server) it would not respond to queries.  Back to the google.

I search for the phrase “osx bind cant ping local domain”, and wouldn’t you know it, the Google machine came through again.  I found this post dating back from 2002 that solved the problem.  Seeing the date of 2002, I was skeptical since BIND has had some many advances since then, and of course OSX is a totally different beast, but I was desperate.  Low and behold they were correct though.  It appears that Bonjour will snag queries for domains with TLD of “.local”, thereby cutting BIND completely out of the deal.

I am sure that there is some configuration that could get one past this, but I am fine just moving my local development domains to .net and calling it a job well done.

Thanks Google machine, what in the world would I do without you! (No seriously, I realized the other day, that I would be 1/100th the programmer I am today, not to mention the productivity and speed, without modern search engines like Google).

Needed to add a bunch of files to my (mercurial) hg repo and realized that a command I use all the time in subversion (svn) repos.

hg st | grep ? | sed ‘s/? *//’ | xargs hg add

Break it down for ya.  Remember the “|” unix character takes the results of stdout and pipes that as the inputs to the next chain in the command.  For the purposes of explanation, assume I were to create a file called testfile.js in the “js” directory in my repo directory.

1. hg st – this displays the files in an hg repo that are currently not versioned in the repo.  Results are sent to stdout.


? js/testfile.js

2. grep ? – This looks at each line and returns it valid if there is a ? in the string.


? js/testfile.js

3. sed ‘s/? *//’ – sed is an awesome text tool for performing operations on text,  in this case a executing a regex on each line that removes that ? from the text.  This is important because the next command does not recognize “?” as in the filename.



4. xargs hg add – Finally, we execute the command on the sanitized string.

A js/testfile.js