Rails tip of the day: Rails + OS X Lion + rvm + nokogiri
I followed this guide, but still had trouble getting nokogiri to install.
Nokogiri complained about libiconv, but the culprit wasn't libiconv. It was libxml2 and libxlst.
Here's the output from trying to install nokogiri:
In other instances, I did manage to get it installed somehow, but when I tried to run "rails c", I'd get this error:
Ultimately, the answer was this gist, which I resisted for a long time, because I thought it wasn't libxml2/libxslt that was missing, but libiconv. I was wrong.
I did have to change the last line to refer to version 2.7.8 of libxml2 rather than 2.7.7. Minor change.
I hope this blog post will save you the hour or two that I wasted wrestling with this stupid issue :)
Nokogiri complained about libiconv, but the culprit wasn't libiconv. It was libxml2 and libxlst.
Here's the output from trying to install nokogiri:
✗ gem install nokogiri -v 1.4.4
Fetching: nokogiri-1.4.4.gem (100%)
Building native extensions. This could take a while...
ERROR: Error installing nokogiri:
ERROR: Failed to build gem native extension.
/Users/lars/.rvm/rubies/ree-1.8.7-2011.03/bin/ruby extconf.rb
checking for libxml/parser.h... yes
checking for libxslt/xslt.h... yes
checking for libexslt/exslt.h... yes
checking for iconv_open() in iconv.h... no
checking for iconv_open() in -liconv... no
-----
libiconv is missing. please visit http://nokogiri.org/tutorials/installing_nokogiri.html for help with installing dependencies.
-----
In other instances, I did manage to get it installed somehow, but when I tried to run "rails c", I'd get this error:
/Users/lars/.rvm/gems/ree-1.8.7-2011.03/gems/nokogiri-1.4.4/lib/nokogiri/nokogiri.bundle: [BUG] Segmentation fault
Ultimately, the answer was this gist, which I resisted for a long time, because I thought it wasn't libxml2/libxslt that was missing, but libiconv. I was wrong.
I did have to change the last line to refer to version 2.7.8 of libxml2 rather than 2.7.7. Minor change.
I hope this blog post will save you the hour or two that I wasted wrestling with this stupid issue :)
About Calvin Correli
I've spent the last 17 years learning, growing, healing, and discovering who I truly am, so that I'm now living every day aligned with my life's purpose.
5 comments
Leave a comment