Building Homebrew Packages
Recently I have been using Homebrew to install Open Source tools on my Mac. I find it to be a little more to my taste than MacPorts. But when I wanted to install TTYtter, a small Twitter command-line client, I discovered that Homebrew doesn't yet have a package for TTYtter.
After a quick chat with JohnAlbin, I decided to try building my own Homebrew formula for TTYtter. John has also successfully built a homebrew package or two. He re-assured me that learning the system wasn't going to require a huge investment of my time.
Fifteen minutes later, I committed my new script to the project, and it is now being considered for inclusion in Homebrew's repository. And almost all of the heavy lifting is done by the homebrew toolchain and git.
How easy was it? Well... I simply followed the directions, and moments later had this recipe:
require 'formula' class Ttytter <Formula url 'http://www.floodgap.com/software/ttytter/dist1/1.1.03.txt' homepage 'http://www.floodgap.com/software/ttytter/' md5 'e00f3b9cac53f011c7c597af4729b0a5' def install bin.install '1.1.03.txt' => 'ttytter' end end
Now, I'm just a Ruby neophyte, and I didn't even have to whip out my Ruby reference guide. Homebrew generated almost all of the code for me. What I didn't learn directly from the manual, I learned by looking at a couple of very simple Homebrew recipes at GitHub. Really, the only thing I spent substantial time on was making sure I didn't miss any dependencies. That had more to do with the TTYtter source code than anything else.
Homebrew is an easy way to install packages. It turns out that it's almost as easy to add new packages. This combination is going to lead to big success for that little project.