Error to Install Nokogiri on Osx 10.9 Maverick

Error to install Nokogiri on OSX 10.9 Maverick?

I found this log and saw that gcc-4.2 was not found:

package configuration for libxslt
cflags: -I/usr/local/Cellar/libxslt/1.1.28/include -I/usr/local/Cellar/libxml2/2.9.1/include/libxml2
ldflags: -L/usr/local/Cellar/libxslt/1.1.28/lib -L/usr/local/Cellar/libxml2/2.9.1/lib
libs: -lxslt -lxml2 -lz -lpthread -liconv -lm -lxml2

package configuration for libxml-2.0
cflags: -I/usr/local/Cellar/libxml2/2.9.1/include/libxml2
ldflags: -L/usr/local/Cellar/libxml2/2.9.1/lib
libs: -lxml2

package configuration for libiconv is not found
"/usr/bin/gcc-4.2 -o conftest -I/Users/ericcamalionte/.rvm/rubies/ruby-1.9.2-p320/include/ruby-1.9.1/x86_64-darwin11.4.0 -I/Users/ericcamalionte/.rvm/rubies/ruby-1.9.2-p320/include/ruby-1.9.1/ruby/backward -I/Users/ericcamalionte/.rvm/rubies/ruby-1.9.2-p320/include/ruby-1.9.1 -I. -I/usr/local/Cellar/libxslt/1.1.28/include -I/usr/local/Cellar/libxml2/2.9.1/include/libxml2 -I/usr/local/Cellar/libiconv/1.14/include -I/Users/ericcamalionte/.rvm/gems/ruby-1.9.2-p320@dns-panel/gems/nokogiri-1.6.0/ports/x86_64-apple-darwin13.0.0/libxml2/2.8.0/include -I/Users/ericcamalionte/.rvm/gems/ruby-1.9.2-p320@dns-panel/gems/nokogiri-1.6.0/ports/x86_64-apple-darwin13.0.0/libxslt/1.1.26/include -I/Users/ericcamalionte/.rvm/usr/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wshorten-64-to-32 -Wno-long-long -fno-common -pipe -g -DXP_UNIX -O3 -Wall -Wcast-qual -Wwrite-strings -Wconversion -Wmissing-noreturn -Winline -DNOKOGIRI_USE_PACKAGED_LIBRARIES -DNOKOGIRI_LIBXML2_PATH='"/Users/ericcamalionte/.rvm/gems/ruby-1.9.2-p320@dns-panel/gems/nokogiri-1.6.0/ports/x86_64-apple-darwin13.0.0/libxml2/2.8.0"' -DNOKOGIRI_LIBXSLT_PATH='"/Users/ericcamalionte/.rvm/gems/ruby-1.9.2-p320@dns-panel/gems/nokogiri-1.6.0/ports/x86_64-apple-darwin13.0.0/libxslt/1.1.26"' -I/usr/local/Cellar/libxslt/1.1.28/include -I/usr/local/Cellar/libxml2/2.9.1/include/libxml2 -I/usr/local/Cellar/libxml2/2.9.1/include/libxml2 conftest.c -L. -L/Users/ericcamalionte/.rvm/rubies/ruby-1.9.2-p320/lib -L/usr/local/Cellar/libxslt/1.1.28/lib -L/usr/local/Cellar/libxml2/2.9.1/lib -L/usr/local/Cellar/libiconv/1.14/lib -L/Users/ericcamalionte/.rvm/gems/ruby-1.9.2-p320@dns-panel/gems/nokogiri-1.6.0/ports/x86_64-apple-darwin13.0.0/libxml2/2.8.0/lib -L/Users/ericcamalionte/.rvm/gems/ruby-1.9.2-p320@dns-panel/gems/nokogiri-1.6.0/ports/x86_64-apple-darwin13.0.0/libxslt/1.1.26/lib -L/Users/ericcamalionte/.rvm/usr/lib -L. -Wl,-rpath,/Users/ericcamalionte/.rvm/gems/ruby-1.9.2-p320@dns-panel/gems/nokogiri-1.6.0/ports/x86_64-apple-darwin13.0.0/libxml2/2.8.0/lib -Wl,-rpath,/Users/ericcamalionte/.rvm/gems/ruby-1.9.2-p320@dns-panel/gems/nokogiri-1.6.0/ports/x86_64-apple-darwin13.0.0/libxslt/1.1.26/lib -L/usr/local/Cellar/libxslt/1.1.28/lib -L/usr/local/Cellar/libxml2/2.9.1/lib -L/usr/local/Cellar/libxml2/2.9.1/lib -lxslt -lxml2 -lz -lpthread -liconv -lm -lxml2 -lxml2 -lruby.1.9.1-static -lpthread -ldl -lobjc "
sh: /usr/bin/gcc-4.2: No such file or directory
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main() {return 0;}
/* end */

To solve this problem I intalled apple-gcc42 using homebrew brew install apple-gcc42 and created a symlink to my /usr/bin :

sudo ln -s /usr/local/Cellar/apple-gcc42/4.2.1-5666.3/bin/gcc-4.2 /usr/bin/gcc-4.2

rails : install nokogiri fails on Mac OSX Yosemite

One of issues was that you were manually installing Nokogiri 1.6.6.2, but not including the nokogiri gem entry in your Gemfile. Bundler will specifically only show your app the gems that are listed in the file.

It wasn't clear to me if you were tied to nokogiri 1.6.1 because it was a dependency of another gem. If there was another gem calling for 1.6.1 then you would investigate a newer version of that gem, which hopefully depended on the newer Nokogiri. bundle update <othergem> would attempt to do so.

Just wanted to be clear that I wasn't suggesting modifying another gem's dependencies in your lock file as they were set for a reason by that gem's author.

Since you initially specified gem 'nokogiri', '~> 1.6.1' in your Gemfile you were locked to that after the first bundle install. bundle update nokogiri would try to update you to the latest. Or manually changing the Gemfile to 1.6.6.2 or more loosely ~> 1.6 or 1.6.6.

Also, as @the Tin Man mentioned using sudo install to put gems into the Apple system ruby isn't the best way to go. I definitely recommend using one of the Ruby version managers like RVM or rbenv as he linked in his comment.

Error installing Nokogiri gem on Mac OS X

If you are using brew use this in the terminal:

brew unlink gcc-4.2      # you might not need this step
gem uninstall nokogiri
xcode-select --install
gem install nokogiri

If this didn't work please check "Installing Nokogiri on OSX 10.10 Yosemite"

Nokogiri fails to install on OS X

Command Line not installed:

This is the easiest one to check and fix: run xcode-select --install in a terminal window to install it, then try installing Nokogiri one more time by running gem install nokogiri.

Some are reporting that they used gem install nokogiri -- --use-system-libraries

Libxml, libxlt are too recent:

This situation is due to the fact that these libraries, when installed using homebrew, may be too recent. This situation leads to incompatibilities and fatal errors during installation.

To fix this, there are 2 main options:

gem install nokogiri -- --use-system-libraries --with-xml2-include=/usr/include/libxml2 --with-xml2-lib=/usr/lib/

or

brew unlink libxml2
brew unlink libxslt
brew unlink libiconv
sudo xcode-select --install
gem install nokogiri

For more details about the reasons why, please refer to issue 1166 on github.

rails cannot install nokogiri w Mavericks & rbenv

I got the same error a few weeks ago. This is how I solved it:

You'll have to install the broken libraries manually. Use Homebrew, which is a package manager for OS X. Make sure you update first brew update, then install the libraries:

brew install libxml2 libxslt
brew link libxml2 libxslt

You may have to 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

And then you should be able to install the gem.

Quoted from documentation here:
http://nokogiri.org/tutorials/installing_nokogiri.html#homebrew_09

You may also need to run rbenv rehash after installing the libraries.

Why does installing Nokogiri on Mac OS fail with libiconv is missing?

I had the same issue. Unfortunately the "Installing Nokogiri" doesn't cover Iconv issues. Here's how I resolved the issue.

First install homebrew, it'll make your life easier. If you already have it installed, be sure to grab the latest formulae by updating like so:

brew update

Note: In OSX 10.9+ you may need to install xCode command tools to allow you to install libiconv.

xcode-select --install

then install a newer version of libiconv

brew install libiconv

then install your gem

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


Related Topics



Leave a reply



Submit