Apr 5, 2011

Homebrew rocks but..

I love Homebrew.. I like the simplicity of it and generally, it just works. Every once in a while though something goes wrong and you need to back up to an older version of a package. Doing so is not terribly intuative. The process goes something like this:

1. Head over to your /usr/local/Library/Formula/ directory and search for the commit prior to the one one where your formula was updated. For example I needed to grab hadoop 0.20.2

git log -S 0.20.2

2. Once you find the commit you're looking for, go ahead and checkout the commit into a new branch.

git checkout -b older_hadoop_0.20.2 03e4d25c1a01418d2fc104a1642ec56bd3eab4ca

3. Once you've got it, remove older versions and reinstall:

brew remove hadoop --force
brew install hadoop

This should get the version of the package you're looking for.

But I still have some issues. For some reason, this commit had no formula for hive. So running brew install hive gave me an error that it didn't exist. Checking out master and installing hive from there started the process of downloading the latest hadoop (0.21.something). I ended up having to checkout a branch from a way older commit in 2010 where I know the combination worked and install from there.

So my brief lists of wants here:

1. Easier way to install older versions of a forumula (including specifying versions of dependencies)

2. Way to pin a version of a package you have so it's not upgraded.

3. After typing "brew upgrade", confirm what's going to be upgraded and ask for permission with a y/N

All of those would make amazing additions to the homebrew system! And finally, thanks for not suggesting I make these improvements myself as I would if I felt comfortable doing so.

PS: Special thanks to oligofren who provided the solution over on Stack Overflow.

No comments:

Post a Comment