Wednesday, January 05, 2011

Bundler Install issue with Nokigiri on OS/X

I finally have an opportunity to move into the Ruby 1.9.2 and Rails 3.0 world having spent some time in earlier versions while supporting our main applications. Let's note that I know some other folks who are in a similar situation, which may have been predicated by our moving from OS/X 10.5 Leopard to 10.6 Snow Leopard by using the automatic migration rather than by manually re-installing all of our libraries, tools and applications. I had to do some rebuilding and patching just to get my Snow Leopard system up and running. However, this may be an hold-over from that process.

I used RVM to keep my Ruby 1.8.6 and 1.9.2 versions playing nicely. After installing Ruby 1.9.2 (wicked easy), I downloaded Rails 3.0.3, got the code base and ran 'bundler install' to install all the needed gems.

The process failed while building nokogiri. The error was:

libiconv is missing. please visit http://nokogiri.org/tutorials/installing_nokogiri.html for help with installing dependencies.

Popping over to the supplied URL showed that I probably needed the libxml2 and libxslt libraries. I didn't think so because I was sure nokogiri was working in my other ruby environment, but nonetheless I ran:
sudo port install libxml2 libxsl
After doing so, I tried the bundle install again only to have the same error.

Now I was looking at a crisis. One colleague who has successfully navigated this waterway recommended that I rely on homebrew for package management. However, I've used port and fink, plus homebrew doesn't link to system directories by default, so I knew there would be some pain. I briefly considered uninstalling port and moving entirely to homebrew, but I have nearly 200 installed packages. Didn't want to go there.

Simultaneously, I was working in another terminal when I realized that my subversion was no longer working. It was complaining about a newly installed libiconv, which was installed with the libxml2. This actually was a good thing.

Now cutting to the chase: The Berekly DB needed to be updated in order to make all these things work. So I uninstalled Berekly DB, which involved uninstalling apr-util, python26, subversion, serf, and gone-doc-utils (using port for all of this). Then I did a 'port clean ' on all those packages and reinstalled everything.

Subversion now worked, but the bundle install still failed. Confident that the problem lay elsewhere, I cast around and found Chris Roos' post on Libxml2 Problems when Installing Nokogiri.

The solution I chose was to do a universal install of the libxml and libxlst libraries with

  $ sudo port upgrade --enforce-variants libxml2 +universal
 $ sudo port upgrade libxslt +universal
The bundle install worked after this, Subversion still works and I'm back in business.

No comments:

Post a Comment