Homebrewing with Homebrew

I'm a bit of an Apple fan, most of my private development is done using Mac OSX. Apple doesn't distribute OSX with most of the software packages I use. Instead, I use Homebrew to install new packages, their dependencies, check for updates, and remove everything again when I am finished.

However, even the extensive collection of software that Homebrew supports isn't always going to be able to provide an obscure or unusual piece of software that I might want to install. So I created a Homebrew Tap, which I called Arcane, to manage such packages.

Homebrew introduced Taps in 0.9. Taps Taps are a way of creating repositories of Homebrew formula that are independent of the main Homebrew repository. Homebrew maintains a list of interesting taps, but anyone can create their own.

Creating a new Tap is straight forward. First, create a new repository on Github. There is a naming convention for creating a Tap repository, it must begin with homebrew-. The remainder is the name of the Tap. My Tap is called Arcane, so the repository is homebrew-arcane.

Once the new repository is created, it can be tapped using brew tap user/repo. Where user is your GitHub user account and repo is the name of your Tap repository. (The bit after homebrew-) The repository will be cloned into /usr/local/Library/Taps. To tap Arcane I used brew tap aliles/arcane.

Now you can begin creating formula for your new Tap. Homebrew has a guide on how to create a new formula that covers the basics. Unfortunately you will likely need to read existing formula to learn the more advanced features of Homebrew.

After running brew create, a new formula will be created in /usr/local/Library/Formula. As formula are Ruby scripts, you can move the formula from its initial location to your Tap repository in /usr/local/Library/Taps/user-repo. After moving the formula it is necessary to run brew tap --repair to ensure a symbolic link to the formula is created in /usr/local/Library/Formula. Without this link Homebrew is unable to find the formula to install it.

Once you have finished developing your formula, commit it to the repository. Congratulations, you are now the maintainer of a Homebrew Tap of interesting formula. As a bonus you can now also repeatedly and reliably install (and remove) this software again at any time in the future, should you be desire to do so.

Making a command out of shutil

I love the creating that developers show in making unintended use of a tool to solve a problem. It doesn't matter if that use is a "good idea" or not. Regardless of whether it's a "good idea" or not. The ingenuity and problem solving demonstrated is usually quite fascinating. Like this little hack that my friend mjdorma shared with me that uses Begins' sub-commands.

import shutil
import begin


# Patch in doc before the func is wrapped by begin.start
def patch_doc(doc):
    def decorate(func):
        func.__doc__ = doc
        return func
    return decorate

def main():

This little script gives you access to a number of utility functions from Python's shutil module from the command line. Admittedly there are common Unix utilities that provide most of this functionality. But I still felt it was a nifty and entertaining use of functionality I had just written.

After using Begins for a few weeks this type of application has become a common pattern for Begins. Sub-commands excel at creating small administration programs that are a collection of related commands. Even more exciting is that others groups are successfully orchestrating much larger systems using Begins as a framework. Its terrific to know that Begins is meeting its goal of growing with the developer.

You can download this script from Michael's original GitHub Gist.

My only advice to soon to be fathers

A number of my friends have announced that they will soon become fathers for the first time. I'm extremely excited for them, as are they. Already being a dad I try hard to share my experiences of fatherhood, and not just dispense advice. Each child is unique, each family is different. Advice that would work for me isn't necessarily going to work for someone else. That is, except for one solitary piece of advice I do give to all prospective fathers.

Once you have decided on names, write both names (with correct spelling) on a piece of card and keep it in your wallet.

Leading up to the birth of my first daughter, we alternated between 'belle and 'bella. The day of her birth didn't proceed according to our obstetrician's plan. Standing after at the nurses station, my wife in post-operative care, me in possession of a baby and having no idea what to do now. The nurse asked me if we had chosen a name. I said "yes" and proceeded to do my best goldfish impersonation as I suffered a mental blank.

To this day we're not sure if I used the last name we had actually chosen. It doesn't matter today. Still, for any future fathers out there, save yourself a little extra stress on that big day. And congratulations.