Categories
Random observations

Installing nokogiri on Mac OS X

A quick search reveals that I’m not the only one who’s had difficulty installing the nokogiri Ruby gem on Mac OS X. The official docs recommend installing the fink or macports versions of libxml2, and so does this nokogiri tutorial over on the Engine Yard blog. I like macports. It’s a good way to stay up to date with the latest and greatest versions of everything, but I have this thing about trying to make things work with the libraries that come as standard on Mac OS X. I don’t know, maybe it’s that it reduces dependencies, or maybe I’m just strange.

Anyway, here’s how I got nokogiri to install under Snow Leopard without resorting to macports or fink:

sudo gem install nokogiri -- --with-xml2-include=/usr/include/libxml2 --with-xml2-lib=/usr/lib --with-xslt-dir=/usr

What’s weird is that, unless I’m mistaken, those paths are exactly where nokogiri should be looking for the relevant libxml2 files in the first place! I’m still to find out whether it all works as it’s supposed to. But installation is the first step! Let me know if it works for you.

By ricky

Husband, dad, R&D manager and resident Lean Startup evangelist. I work at NICTA.

11 replies on “Installing nokogiri on Mac OS X”

Since there is so many fields of sieipaltces that I have a choice of, I still really can’t choose one. So I am going base on my personal experiences. My original goal back in high school and maybe even before that, was to work in a Neonatal ICU! I had a brother that passed before he had his first birthday from heart complications, and that year I spent a lot of time at hospitals with my parents. My goal the first couple of years was to work with babies just like him. That was until I had my own children, I would of still loved to have worked in that career field but the heart ache I would most likely endure when one of those babies did not make it home. I could not have handled!On to more positive experiences, I have worked with the elderly and Geriatrics interests me very much. Being surrounded with people that have lived a fulfilled life is so much more rewarding. Even though at times it is the ending stages of their lives, and it is sad when someone does pass. It’s less of a heartache to know that most of the time they are ready to move on. They are still very dependent on you and when you are able to help them with their needs that’s the most rewarding of all, plus you form a special relationship with the patients and their families.

Yes! Thank you so much. Been tearing my hair out all afternoon trying to install f**king Nokogiri. Everything on Nokogiri’s site didn’t work. Thanks again.

Leave a Reply

Your email address will not be published. Required fields are marked *