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.
11 replies on “Installing nokogiri on Mac OS X”
Installing nokogiri on Mac OS X: http://rickyrobinson.id.au/2010/01/25/in… (RickyRobinson.id.au)
@rickyrobinson is nokogiri the best rails xml parser?
@simultech Apparently it’s got a few things going for it. I had to install it because of the cucumber -> webrat -> nokogiri dependencies.
Ricky,
You rock! Was TEARING my hair out trying to get this thing to install! This was the only thing that worked!
Used this method today, nearly two years after the post (having first tried installing and linking libxml2 and libxslt with Homebrew), and it is *still* the way that worked – unlike the official docs at http://nokogiri.org/tutorials/installing_nokogiri.html. Thanks!
I was having major problems with getting nokogiri to install on Lion as part of a bundle and fixed it using CFLAGS=”-I/usr/local/include -L/usr/local/lib” bundle install.
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.
AwxEh7 niczfqnoijdh
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.
you pretty much just saved my life. Thank you!
continuously i used to read smaller articles that as well clear their motive, and that is also
happening with this article which I am reading now.