A Barrel of This • Blog

I've got a barrel of this. What do I do with it?

2011
Sep 15th

Job search restart

I’ll be moving on from Railsdog at the end of this month (or thereabouts). If you are looking for a Senior Rails developer with an interest in interaction design and data visualizations then give me a shout. Here is a fresh look at my relevant details:

2010
Oct 13th

The Green Zone

Air Condition
Indicator thumbnail Instead of complaining about technology and poor design I thought I might take a moment to discuss a well designed item that I adore. I found this item in a thrift store in the DC area back in the early ‘90s. It tells the temperature and the relative humidity. What’s so great about that? Health and comfort. Health AND comfort…

2010
Sep 30th

Homebrew-Package management for Mac OS X

Unfortunately for me, every once in a while I have to worry about software dependencies. The issue crops up every year or so when there is either a security patch that we (work) need to install or an upgrade we want to attempt. As I get older I’ve become slightly less enthusiastic about upgrading often or at least upgrading quickly. So it was with some trepidation that I removed MacPorts from my MacBook Pro today and decided to give Homebrew a shot.

The good news: It pretty much works for me.
The bad news: It pretty much failed for me within a few hours of installing it.

Failed may be a bit harsh. At work we use a specific version of mysql and that version is compiled with specific options that we require. Homebrew doesn’t make it immediately obvious how you go about requesting a specific version of a package nor how you specify any options for the package when it is built.

I’m not going to bother going over the basics of getting Homebrew up and running as there are already a number of resources for such things. Dr. Google is your friend (or Dr. Bing, or whomever you visit when you are in need). But I will share how to get a Homebrew formula (the recipe for building packages) to do what you want in a few simple steps.

Altering a Homebrew recipe

At first I thought it might be necessary to fork the git repository of homebrew or at least make a fork, branch, or copy of the mysql.rb formula. But, that would have been a lot of overhead for simply altering some build options. Also, the specific set of options I need are probably only relevant to me on this particular project. They certainly would not be the correct options for everyone.

To alter the options one can simply edit the Ruby formula file in brew --prefix/Library/Formula. If you installed Homebrew into /usr/local (which the authors make quite clear that they would very much like you to do) then the path would be: /usr/local/Library/Formula. For example, to edit the mysql build options:

vim `brew --prefix`/Library/Formula/mysql.rb

Look for the array of configure_args. Edit them to your heart’s content.

brew uninstall mysql
brew install mysql

Done! In my case in step two I changed the —with-plugins option to supply the plugins that my mysql install requires.

Alternatively, you could also make a copy of mysql.rb (I actually made a copy of the file myself before editing away). In that case you’d just need to change the class declaration at the top of the file. For example, if you name the file mysql-myCompany.rb then on line 3 you’d change:

class Mysql <Formula 

to

class MysqlMyCompany < Formula 

To ensure your new formula is in place run:

brew info mysql-myCompany

To finish it off you’d need to:

brew uninstall mysql
brew install mysql-myCompany

My sentiment is this: You own the formula directory. It’s on your hard drive, is it not? Do with it as you please.

The drawback of course is that when updating homebrew there may be a conflict on the file or it may just be replaced. I’m hoping since it is just git underneath that the brew update command will give me some way to reconcile the problem. Maybe I’m blindly optimistic. But as I mentioned you can always create your own file if you are concerned.

There also appears to be a HOMEBREW_LIBRARY_PATH environment variable that you could set to temporarily use your own Library and the formula within. Haven’t tried that yet but it is definitely worth a look. Especially if you just want to create your own formula and test it out before embarking on contributing to the de-facto Library.

launchctl is persistent

There were a few nasty issues for me after installing mysql. First, the instructions helpfully provide the command for adding mysql to launchctl so that OS X will start mysql when you boot:

launchctl load -w
2010
Sep 27th

1Password, many irritations

1Password icon At the risk of turning this blog into a forum for my personal grievances I’ve yet another complaint about a recent purchase. Or maybe I’m the problem. You be the judge.

I invested $40 in 1Password by Agile Web Solutions. 1Password is a password management solution for Mac, iPhone, and iPad (also for Windows but, I haven’t tried it out there yet). I’m graduating from info.xhead which was adequate but, doesn’t give one an option to sync across devices nor does it integrate in any way with browsers. My very generous wife bought me an iPad for my birthday so I now have a collection of Apple devices without any sort of password syncing between them. The iPad version of 1Password was an additional $15…

2010
Sep 25th

Apple annoyances

This is the start of a list of bugs or design quirks that I encounter in my daily use of Apple products of which I own plenty (an embarrassing number really). I’m not an Apple fan boy but, I do like my products to work together and not get in my way. Apple pretty much gets that right. However, there are issues both large and small that disrupt the otherwise seamless cohesion of One Infinity Loop products. Here are some off of the top of my head. I’ll add more as they pop up…