Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libiconv is missing #442

Closed
polarblau opened this issue Apr 3, 2011 · 109 comments
Closed

libiconv is missing #442

polarblau opened this issue Apr 3, 2011 · 109 comments

Comments

@polarblau
Copy link

We're running Ruby 1.8.7 (through RVM) on OS X 10.6.6. Trying to install nokogiri 1.4.4 using bundler results always the following error:

Installing nokogiri (1.4.4) with native extensions /Users/administrator/.rvm/rubies/ruby-1.8.7-p302/lib/ruby/site_ruby/1.8/rubygems/installer.rb:533:in `build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)

/Users/administrator/.rvm/rubies/ruby-1.8.7-p302/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.
-----
*** extconf.rb failed ***
[…]

Following the instructions here in the wiki as well as around the net we've used MacPorts to install libxml2 and libxslt, which results in the following situation:

sudo port install libxml2 libxslt
Password:
Error: Cannot install libxml2 for the arch(s) 'x86_64' because
Error: its dependency libiconv is only installed for the archs 'i386 ppc'.
Error: Unable to execute port: architecture mismatch

We've build libxml2 and libxslt from source and tried both to install the gem with the flags for the MacPorts and the build as described in the wiki as well as a few variations found online. — The results remains the same. We've even downloaded the gem, changed extconf.rb as suggested here: https://github.com/tenderlove/nokogiri/issues#issue/381, and compiled it locally but the final outcome is the same.

What are we missing? We're pretty much stuck with this situation.

@geoffw8
Copy link

geoffw8 commented Apr 26, 2011

I asked this same question, and was given this response:

Install MacPorts: http://www.macports.org
Add /opt/local/bin to your PATH (bashrc or zshrc or whatever you use).
sudo port install libxml2 and sudo port install libxslt
Then sudo gem install nokogiri --no-rdoc --no-ri should run with no issues. That's all I had to do for the system ruby (1.8.7 on OSX 10.6) and 1.9.2 via rvm.

@nategood
Copy link

I was having the same issues on 10.6. I re-installed MacPorts, port installed libxml2 and libxslt again and now I'm no longer experiencing these issues.

@MickWest
Copy link

Assuming you installed libxml2 and libxslt with MacPorts, then you might still be getting this error due to a mismatch of the order of include paths and link paths used by the call to have_func('iconv_open', 'iconv.h')

Simple (patch) solution: delete libiconv.* in /usr/local/lib

Suggestion: have extconf.rb perform slightly more sophisticated checking of what iconv libs are actually installed, and give the user a better clue. In this case libiconv is NOT missing. There's actually TWO libiconvs, the correct header was being compiled, and an old library was being linked. Seems like a very common problem that the install file error message could give a little more help with.

@MickWest
Copy link

And I think this might be an issue with mkmf and the way it handles library paths? The failing compile check for me was:

Undefined symbols for architecture x86_64:
  "_libiconv_open", referenced from:

Note the compile stage starts with /opt/local/include, but the link stage starts with /usr/local/lib, which is where the old version was

@jfahrenkrug
Copy link

I'm using Lion and homebrew. For me, this did the trick:

brew install libiconv
brew link libiconv

@bulteau
Copy link

bulteau commented Dec 5, 2011

In my case (Migration to OS X Lion), to fixe the problem, I cleaned macports :

port -qv installed > myports.txt
sudo port -fp uninstall --follow-dependents installed
sudo port clean all

More details : http://trac.macports.org/wiki/Migration

@jomz
Copy link

jomz commented Jan 19, 2012

+1 to what jfahrenkrug said. The installation guide on http://nokogiri.org/tutorials/installing_nokogiri.html, homebrew section should probably be updated;

brew install libxml2 libxslt
brew link libxml2 libxslt

to

brew install libxml2 libxslt libiconv
brew link libxml2 libxslt libiconv

@willmcneilly
Copy link

jfahrenkrug's fix also worked for me

@SweeD
Copy link

SweeD commented Feb 13, 2012

+1 works for me

@jseigler
Copy link

I've followed the instructions to build libxml2 and libxslt from brew. I can't build nokogiri.

I get an error when I try 'brew install libiconv':

$ brew install libiconv
Error: No available formula for libiconv
Apple distributes libiconv with OS X, you can find it in /usr/lib.
Some build scripts fail to detect it correctly, please check existing
formulae for solutions.

I'm on a fresh Snow Leopard install. I'd rather not use MacPorts.

Please help.

@flavorjones
Copy link
Member

@jseigler I'm running brew 0.8.1 and I can install libiconv with no problem. Try upgrading brew?

@ericc59
Copy link

ericc59 commented Mar 20, 2012

I had the same issue as @jseigler. I'm running brew 0.9 on OS X 10.7.3.

Downloading libiconv and compiling manually worked.
http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.13.1.tar.gz

@flavorjones
Copy link
Member

If you figure out how to install Nokogiri against brew 0.9 libraries, please let me know -- I'll update installation documentation. In the meantime, though, as a user primarily of Linux, I'm afraid I can't be of much help.

@tenderlove, any ideas? You <3 macs. :) :) :)

@brennenf
Copy link

Using brew 0.9 on OSX 10.7.3 the following worked:

brew install libxml2 libxslt
brew link libxml2 libxslt

Install libiconv from source:
wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.13.1.tar.gz
tar xvfz libiconv-1.13.1.tar.gz
cd libiconv-1.13.1
./configure --prefix=/usr/local/Cellar/libiconv/1.13.1
make
sudo make install

Then install nokogiri:
gem install nokogiri -- --with-xml2-include=/usr/local/Cellar/libxml2/2.7.8/include/libxml2 --with-xml2-lib=/usr/local/Cellar/libxml2/2.7.8/lib --with-xslt-dir=/usr/local/Cellar/libxslt/1.1.26 --with-iconv-include=/usr/local/Cellar/libiconv/1.13.1/include --with-iconv-lib=/usr/local/Cellar/libiconv/1.13.1/lib

@Undistraction
Copy link

@ brennenf

Nice work. That did it for me too.

@flavorjones
Copy link
Member

Instructions posted to nokogiri.org:

http://nokogiri.org/tutorials/installing_nokogiri.html#homebrew_09

Thanks, everybody.

@ChasManRors
Copy link

@brennenf Thanks for this line
gem install nokogiri -- --with-xml2-include=/usr/local/Cellar/libxml2/2.7.8/include/libxml2 --with-xml2-lib=/usr/local/Cellar/libxml2/2.7.8/lib --with-xslt-dir=/usr/local/Cellar/libxslt/1.1.26 --with-iconv-include=/usr/local/Cellar/libiconv/1.13.1/include --with-iconv-lib=/usr/local/Cellar/libiconv/1.13.1/lib

@ttringas
Copy link

@brennenf your fix gets me a nice "Successfully installed nokogiri-1.5.2" but when I run bundle install in my rails app it still fails on: "An error occured while installing nokogiri (1.5.2), and Bundler cannot continue.
Make sure that gem install nokogiri -v '1.5.2' succeeds before bundling." Note "gem install nokogiri -v '1.5.2" also fails. Anyone else running in to this?

@flavorjones
Copy link
Member

@ttringas - please email nokogiri-talk. this issue is regarding nokogiri 1.4.4 and has been closed for months.

@powermike
Copy link

Hi any updates on Mountain Lion ?
I can't get the installation done.

I've updated the path mentioned on nokogiri installation page :

gem install nokogiri -- --with-xml2-include=/usr/local/Cellar/libxml2/2.8.0/include/libxml2 --with-xml2-lib=/usr/local/Cellar/libxml2/2.8.0/lib --with-xslt-dir=/usr/local/Cellar/libxslt/1.1.26 --with-iconv-include=/usr/local/Cellar/libiconv/1.13.1/include --with-iconv-lib=/usr/local/Cellar/libiconv/1.13.1/lib

this is what i've in return: https://gist.github.com/3186643

@pietia
Copy link

pietia commented Jul 27, 2012

@polarblau look who has problems now :D (me)

@powermike
Copy link

It might help but it seems the RVM "ecosystem" seems buggy after updating to mountain lion. I remove the .rvm and install rvm using http://unfiniti.com/software/mac/jewelrybox/ and now it works but I have a warning that says:
WARNING: Nokogiri was built against LibXML version 2.8.0, but has dynamically loaded 2.7.8

@pietia
Copy link

pietia commented Jul 27, 2012

Same here, reinstalling ruby did the trick (i'm not really surprised - that's pretty common pitfall)

@polarblau
Copy link
Author

@pietia
Copy link

pietia commented Aug 1, 2012

@polarblau, to late! i've read that already ;)

@mike-park
Copy link

To get the installation working on my newly upgraded Mountain Lion I had to remove my previously installed rvm packages (located in $rvm_path/usr), rebuild ruby 1.9.3, and then gem install nokogiri succeeded. See https://rvm.io/packages/

@spencerfry
Copy link

I'm on Mountain Lion. Reinstalling Ruby worked for me.

@brax4444
Copy link

checking for libxml/parser.h... no

libxml2 is missing.

I found one extra step was required to solve the above for Homebrew 0.9 on Mac OS X 10.8 Mountain Lion and that is to create a "/usr/bin/gcc-4.2" link:

brew install libxml2 libxslt
brew link libxml2 libxslt
wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.13.1.tar.gz
tar xvfz libiconv-1.13.1.tar.gz
cd libiconv-1.13.1
./configure --prefix=/usr/local/Cellar/libiconv/1.13.1
make
sudo make install
sudo ln -s /usr/bin/gcc /usr/bin/gcc-4.2
gem install nokogiri -- --with-xml2-include=/usr/local/Cellar/libxml2/2.8.0/include/libxml2 --with-xml2-lib=/usr/local/Cellar/libxml2/2.8.0/lib --with-xslt-dir=/usr/local/Cellar/libxslt/1.1.26 --with-iconv-include=/usr/local/Cellar/libiconv/1.13.1/include --with-iconv-lib=/usr/local/Cellar/libiconv/1.13.1/lib

@kayzee
Copy link

kayzee commented Sep 14, 2012

brax4444 thanks so much, you are a life saver!! Worked perfectly with the addition of a sudo on your last command because of the error:

ERROR: While executing gem ... (Errno::EPERM)
Operation not permitted - ~/.rvm/gems/ruby-1.9.3-p194/gems/nokogiri-1.5.5/.autotest

@SeanWangDev
Copy link

@lamont-granquist This is a bit out of my depth now. How can we know libiconv.dylib is damaged?
When I do ls -al /usr/lib/libiconv*, the result is this

xxxx  1 xxx  xxx       16 10  5  2013 /usr/lib/libiconv.2.4.0.dylib -> libiconv.2.dylib
xxxx  1 xxx  xxx  2088992 10  5  2013 /usr/lib/libiconv.2.dylib
xxxx  1 xxx  xxx       20 10  5  2013 /usr/lib/libiconv.dylib -> libiconv.2.4.0.dylib

@lamont-granquist
Copy link

Yeah, that looks fine, this is mine:

% ls -al /usr/lib/libiconv*
lrwxr-xr-x  1 root  wheel       16 Feb 26  2014 /usr/lib/libiconv.2.4.0.dylib@ -> libiconv.2.dylib
-r-xr-xr-x  1 root  wheel  2088992 Feb 26  2014 /usr/lib/libiconv.2.dylib*
lrwxr-xr-x  1 root  wheel       20 Feb 26  2014 /usr/lib/libiconv.dylib@ -> libiconv.2.4.0.dylib

What about /opt/local/lib/libiconv.dylib or /opt/local/include/iconv.h? Either of those could cause issues.

@SeanWangDev
Copy link

@lamont-granquist
Nope, I don't have /opt/ directory. Are these what we are looking for?

-r--r--r--+ 1 User  admin  1052128  9  4 11:30 /usr/local/Cellar/libiconv/1.14/lib/libiconv.2.dylib
-rw-r--r--+ 1 User  admin  1658  9  4 11:22 /usr/local/Library/Taps/homebrew/homebrew-dupes/libiconv.rb
-r-xr-xr-x  1 root  wheel  2088992 10  5  2013 /usr/lib/libiconv.2.dylib

iconv.h files are just these two:

/usr/local/Cellar/libiconv/1.14/include/iconv.h
/usr/include/iconv.h

@lamont-granquist
Copy link

Nope that's all cool. As far as I can see you should be able to 'gem install nokogiri' without any other arguments....

@petehunt
Copy link

petehunt commented Sep 9, 2014

Just wanted to add that gem install nokogiri -v 1.6.3.1 -- --with-iconv-dir=/usr/local worked well for me. When using bundler I had to do bundle config build.nokogiril --with-iconv-dir=/usr/local

@SeanWangDev
Copy link

@lamont-granquist Yes, gem install nokogiri works fine now. But this condition is different. This time nokogiri was already installed previously by 'gem install nokogiri -- --with-iconv-dir=/usr/local/opt/libiconv'. Previously, when I didn't have nokogiri installed, 'gem install nokogiri' won't work.
Is it possible that running 'gem install nokogiri -- --with-iconv-dir=/usr/local/opt/libiconv' changed something files or added some files like libiconv.dylib oriconv.h?

@pungoyal
Copy link

@SeanWangDev 👍

@Ilovebarca
Copy link

OS X 10.9.4 Mavericks.
Guys please help me. I tried every single way which is above. None of them working for me. I stacked on gem install nokogiri with/without arguments, im still getting error:

$ gem install nokogiri
Building native extensions. This could take a while...
Building nokogiri using packaged libraries.
ERROR: Error installing nokogiri:
ERROR: Failed to build gem native extension.

/usr/local/rvm/rubies/ruby-2.0.0-p353/bin/ruby extconf.rb

Building nokogiri using packaged libraries.
checking for iconv.h... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.

Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/local/rvm/rubies/ruby-2.0.0-p353/bin/ruby
--help
--clean
--use-system-libraries
--enable-static
--disable-static
--with-zlib-dir
--without-zlib-dir
--with-zlib-include
--without-zlib-include=${zlib-dir}/include
--with-zlib-lib
--without-zlib-lib=${zlib-dir}/lib
--enable-cross-build
--disable-cross-build
/usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:434:in try_do': The compiler failed to generate an executable file. (RuntimeError) You have to install development tools first. from /usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:565:intry_cpp'
from /usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:1044:in block in have_header' from /usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:895:inblock in checking_for'
from /usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:340:in block (2 levels) in postpone' from /usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:310:inopen'
from /usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:340:in block in postpone' from /usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:310:inopen'
from /usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:336:in postpone' from /usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:894:inchecking_for'
from /usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:1043:in have_header' from extconf.rb:103:inhave_iconv?'
from extconf.rb:148:in block (2 levels) in iconv_prefix' from extconf.rb:90:inpreserving_globals'
from extconf.rb:143:in block in iconv_prefix' from extconf.rb:120:ineach_iconv_idir'
from extconf.rb:137:in iconv_prefix' from extconf.rb:428:inblock in

'
from extconf.rb:161:in block in process_recipe' from extconf.rb:154:intap'
from extconf.rb:154:in process_recipe' from extconf.rb:423:in'

Gem files will remain installed in /usr/local/rvm/gems/ruby-2.0.0-p353/gems/nokogiri-1.6.3.1 for inspection.
Results logged to /usr/local/rvm/gems/ruby-2.0.0-p353/gems/nokogiri-1.6.3.1/ext/nokogiri/gem_make.out

@lamont-granquist
Copy link

validate you have these files:

% ls -la /usr/include/iconv.h
-rw-r--r--  1 root  wheel  7981 Jul 29 15:32 /usr/include/iconv.h
% ls -la /usr/lib/libiconv.*
lrwxr-xr-x  1 root  wheel       16 Feb 26  2014 /usr/lib/libiconv.2.4.0.dylib@ -> libiconv.2.dylib
-r-xr-xr-x  1 root  wheel  2088992 Feb 26  2014 /usr/lib/libiconv.2.dylib*
lrwxr-xr-x  1 root  wheel       20 Feb 26  2014 /usr/lib/libiconv.dylib@ -> libiconv.2.4.0.dylib

if you don't, use sudo xcode-select --install and/or go to the apple developer download site and manually uninstall and reinstall xcode and the xcode command line utilities until you get those files installed.

then if you use homebrew, update your homebrew and unlink the libiconv

brew update
brew tap homebrew/dupes
brew uninstall libiconv
brew unlink libiconv
brew install libiconv

validate that you do not have /usr/local/include/iconv.h:

% ls -la /usr/local/include/iconv.h
ls: /usr/local/include/iconv.h: No such file or directory

also validate that you do not have /opt/local/include/iconv.h

% ls -la  /opt/local/include/iconv.h
ls: /opt/local/include/iconv.h: No such file or directory

if you do have that file then you've got iconv installed from macports, ideally you would get rid of this.

then try:

gem install nokogiri
gem install nokogiri -- --with-iconv-dir=/usr
gem install nokogiri -- --with-iconv-dir=/usr/local/opt/libiconv
gem install nokogiri -- --with-iconv-dir=/opt/local

(stop when you find the one that works)

if all else fails:

brew link --force libiconv
gem install nokogiri -- --with-iconv-dir=/usr/local

something in there should work.

@SeanWangDev
Copy link

@lamont-granquist 👍

@knu
Copy link
Member

knu commented Sep 12, 2014

@lamont-granquist Thanks for your instruction, I'm getting what is going on and have started working on a fix. However I'm still unable to reproduce the problem on any of my Macs so there's no way to confirm if a fix works. Can you possibly provide the steps for reproduction?

@lamont-granquist
Copy link

Well, I've had this MBP for 3 years and after 2 OS upgrades and at least 3 TM restores, my /usr/include/iconv.h had disappeared somehow. So nuke'ing that file can cause the problem. The solution is to re-install xcode and the command line tools properly.

Also, while debugging this one thing people suggest doing is to 'brew link libiconv --force' so that it is installed into /usr/local/include/iconv.h -- even though there's huge warnings when you do 'brew install libiconv' and 'brew link libiconv' that this is a bad idea. The problem there is that you can pick up that iconv.h while picking up the system /usr/lib/libiconv.dylib and that has a conflict right away over iconv_open() vs libiconv_open() and fails to compile because they're different versions.

I'm not sure there's anything to fix in those cases. The problem is really with mangling your operating system and needing to back it out to a more pristine shape.

There is one thing I don't understand which is why nokogiri's build system will find MacPorts-installed /opt/local/include/iconv.h files. I don't use MacPorts so haven't debugged that, but its causing similar problems to when homebrew has iconv.h linked directly into /usr/local/include. If nokogiri could be made to stop doing that, it would help with people who have libiconv installed from MacPorts.

@Ilovebarca
Copy link

$ ls -la /usr/include/iconv.h

-rw-r--r-- 1 root wheel 7981 Sep 11 11:32 /usr/include/iconv.h

ls -la /usr/lib/libiconv.*
lrwxr-xr-x 1 root wheel 16 Sep 11 01:03 /usr/lib/libiconv.2.4.0.dylib -> libiconv.2.dylib
-r-xr-xr-x 1 root wheel 2088992 Sep 11 01:02 /usr/lib/libiconv.2.dylib
lrwxr-xr-x 1 root wheel 20 Sep 11 01:03 /usr/lib/libiconv.dylib -> libiconv.2.4.0.dylib

brew update
Updated Homebrew from 45e07c0e to e0dee399.
==> Updated Formulae
android-ndk go lockrun pazpar2
apache-spark h2 mpd pktanon
gearman juju-quickstart ossp-uuid

$ brew tap homebrew/dupes
Warning: Already tapped!

$ brew uninstall libiconv

Uninstalling /usr/local/Cellar/libiconv/1.13.1...

Error: Permission denied - /usr/local/Cellar/libiconv/1.13.1/bin/iconv

it's giving me Permission error on that step

@lamont-granquist
Copy link

you need to fix all your permissions under /usr/local

whatever your login is you need to fix the perms so root does not own homebrew files under /usr/local:

my username is 'lamont' which i can find with the id command:

% id -nu
lamont

to fix perms, i would do:

% sudo chown -R lamont /usr/local

you want to be real careful with that command, though, and double check that you've spelled everything correctly and gotten the right username.

@knu
Copy link
Member

knu commented Sep 13, 2014

@lamont-granquist Doesn't the libiconv package of Homebrew install /usr/local/lib/libiconv.dylib while putting /usr/local/include/iconv.h? What I don't understand is if /usr/local/include/iconv.h is picked up why /usr/local/lib/libiconv.dylib isn't when linking. Usually when -I/usr/local/include is in CPPFLAGS -L/usr/local/lib should be in LDFLAGS.

As for the environmental breakage, Nokogiri could at least suggest (re)installing Command Line Tools when /usr/include/iconv.h is missing on OS X.

@Ilovebarca
Copy link

brew unlink libiconv
Error: No such keg: /usr/local/Cellar/libiconv

I ignored message and followed next steps. No success

@lamont-granquist
Copy link

@knu yeah, i looked into that and i think i got lost in the twisty maze of mkmf.rb.

@lamont-granquist
Copy link

@Ilovebarca rm -f /usr/local/include/iconv.h might help

@Ilovebarca
Copy link

@lamont-granquist
nope didnt help. BTW thanks a lot for trying to help me.
That's crazy, im new on mac and im starting to hate it :))

@knu
Copy link
Member

knu commented Sep 16, 2014

I'm going to make some changes in the iconv detection process and added a check for missing /usr/include/iconv.h on OS X to extconf.rb. Here's a work in progress, and testers are welcome!

@knu knu reopened this Sep 16, 2014
@dikaio
Copy link

dikaio commented Oct 2, 2014

I've been going through github issues, stack exchange, google etc and the only thing that has worked so far has been @lamont-granquist suggestion. Setup using:

OSX 10.9.5
rbenv

@knu
Copy link
Member

knu commented Oct 2, 2014

I understand so many people somehow get their OS X environment broken and they don't even notice that. One problem is missing Xcode Command Line Tools and the other is Homebrew. The next release of nokogiri will try to detect such a breakage before entering the build and warn user of it.

Thanks for your support!

@randz-argonillo
Copy link

Thanks @lamont-granquist, I've been struggling this problem for a week now and finally your solution of reinstalling back libiconv works...that's a relief!!!

@binyamindavid
Copy link

@jomz works on osx 10.10. thanks 👍

@patricksereno
Copy link

From a fresh install of 10.10 just today:

xcode-select --install
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew doctor
brew install ruby
source /etc/profile
gem install nokogiri

This installed ruby version 2.1.5p273 and nokogiri 1.6.4.1. Presumably you could force the install of these versions via homebrew and rubygems.

From a 10.10 install upgraded from 10.9 with homebrew and ruby already installed:

brew install libxml2 libxslt
gem install nokogiri -- --use-system-libraries

I'm not sure it was necessary to re/install libxml2 and/or libxslt, but this did the trick for me.

@flavorjones
Copy link
Member

I believe we've captured this in the updated installation tutorial here:

http://www.nokogiri.org/tutorials/installing_nokogiri.html

If not, please let me know and I'll reopen.

@jeremykohn
Copy link

Thanks for the tutorial link! It worked for me when I specified the file paths, as described in "Using Nonstandard libxml2 / libxslt installations." (Seems /usr/bin in OS X 10.6.8 is considered a nonstandard location for system libraries.)

To find the file paths, I used the Terminal commands which xml2-config and which xslt-config. Maybe update the tutorial to suggest doing this?

flavorjones pushed a commit to sparklemotion/nokogiri.org that referenced this issue Dec 23, 2018
adding step to use gcc-4.2 when installing nokogiri with homebrew 0.9 and osx mountain lion, 
as reported by brax444 (sparklemotion/nokogiri#442 (comment))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests