Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 360 Vote(s) - 3.56 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Why does installing Nokogiri on Mac OS fail with libiconv is missing?

#21
I'm using..
OS X 10.9.4
Homebrew 0.9.4

Here is my summery from this thread to successfully install nokogiri, fixing missing libiconv.

Install [Homebrew][1]

[To see links please register here]

Or update to latest using command below

brew update

Install libxml2 libxslt

brew install libxml2 libxslt

Link both libxml2 libxslt

brew link libxml2 libxslt

If you get warning to use --force, just use command below

brew link --force libxml2 libxslt

Install xCode command tools to enable you to install libiconv

xcode-select --install

Install libiconv

wget

[To see links please register here]

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

Final step, install nokogiri!

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


[1]:

[To see links please register here]

Reply

#22
@Cory's solution contains the correct answer, but the solution on Mavericks is actually much simpler than the top solution so I'm reposting with only the necessary steps.

**On Mavericks (OSX 10.9+):**

Install Xcode Command Line Tools:

xcode-select --install

then install your gem:

gem install nokogiri
Reply

#23
**HOMEBREW USERS**

Correct solution to fix this problem if you are using homebrew:

xcode-select --install

Choose "Get Xcode" from the dialog box.

brew unlink libiconv
gem install nokogiri

The xcode-select step fixes your Xcode installation and Xcode Command Line Utils installation. I found that I didn't have /usr/include/iconv.h due to some kind of problem with O/S upgrades or restores from backups. If you don't have that header file and /usr/lib/libconv.dylib after running xcode-select then you most likely need to drag Xcode from the Application folder to the trash and reinstall and then manually download the Command Line Tools for Xcode from

[To see links please register here]

and install that.

Then you need to unlink the libiconv from homebrew. You don't need this. And clang will actually pick up /usr/local/include/iconv.h over /usr/include/iconv.h and will #define iconv_open to libiconv_open but then link against /usr/lib/libiconv.dylib which does not have libiconv_open which is what causes the mkmf failures to find libiconv. What you need to do is remove the linking in of iconv.h so that nokogiri will not find it.

Then just build nokogiri normally.

For new users, all you should need to do is install xcode with xcode-select and install nokogiri, but if you've found this question then presumably you've got a botched installation and not a fresh install of Mavericks.

Some of the other answers here are definitely incorrect. Most of them attempt to use libiconv out of homebrew which is entirely unnecessary. The answers that `brew link libiconv` are actually causing the problem where clang becomes confused and tries to read a homebrew header file and link against the system libraries. The answers which suggest `--use-system-libraries` are poor because nokogiri needs to be linked against its bundled libxml2 and libxslt libraries because other versions of those libraries are incompatible with it. The answers which want you to compile from sources are just hopelessly overly complicated.

TL;DR:

- Upgrade and/or repair your Xcode installation
- Unlink your homebrew libiconv since trying to use that only causes problems
- Build nokogiri normally

**RVM USERS**

Old RVM installations may have a libiconv hiding in your rvm directories somewhere which are conflicting with your system libraries. See

[To see links please register here]

for more information.

**MacPorts USERS**

If you have /opt/local/lib/libiconv.dylib then nokogiri adds that path to the list of directories that it searches for and it will find the MacPorts installation similar to how it picks up the homebrew libiconv and conflicts with the system libraries. You can try:

sudo port uninstall libiconv

If that fails due to dependencies then you can try linking against the MacPorts version directly (untested):

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

Reply

#24
Try using the system libraries. OSX comes with libiconv in newer versions, but the defaults install script seems to have a problem

gem install nokogiri -- --use-system-libraries

**Edit:** If using bundler, as mentioned by [Geoff](

[To see links please register here]

) you can do:

bundle config build.nokogiri --use-system-libraries
Reply

#25
According to the documentation, as of OSX 10.9 and Homebrew 9.5+, you are probably missing the development tools.

[Nokogiri installation][1]

# Troubleshooting


If you have problems mentioning libiconv missing that looks something like this:

Installing nokogiri (1.6.2.1) Building nokogiri using packaged libraries.

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

/usr/local/rvm/rubies/ruby-2.0.0-p0/bin/ruby extconf.rb
Building nokogiri using packaged libraries.
checking for iconv.h... yes
checking for iconv_open() in iconv.h... no
checking for iconv_open() in -liconv... no
checking for libiconv_open() in iconv.h... no
checking for libiconv_open() in -liconv... no
-----
libiconv is missing. please visit

[To see links please register here]

for help with installing dependencies.
-----
*** extconf.rb failed ***


Then you are probably missing the right developer tools. This is a really easy fix:


brew unlink gcc-4.2 # you might not need this step
gem uninstall nokogiri
xcode-select --install
gem install nokogiri
This is verified working on OSX 10.9 w/ xcode’s clang compiler.


[1]:

[To see links please register here]

Reply

#26
I solved this on `Yosemite` running `Ruby 2.1.4` by

1. ensure you have xCode 6.1 installed, then
2. `xcode-select --install`, then
3. In the AppStore click on _updates_ and install the most recent version of the command-line tools (which apparently `xcode-select --install` does't do - sigh)
4. then `bundle install` worked as normal.

I also did a `brew install libiconv` too but I am not convinced that step was needed.

Reply

#27
I was fighting with Nokogiri for a while today on OS X 10.10 Yosemite

My environment was messed up for some reason.

```which bundle``` and ```which gem``` were giving me ```/usr/bin/bundle``` and ```/usr/bin/gem``` instead of ```~/.rbenv/shims/gem```

What helped correct it for me was ```sudo rm -i /usr/bin/gem /usr/bin/bundle```

After that I:
1. switched back to my project directory
2. uninstalled the dependent
3. (re)-installed the dependent libs: did a ```brew install libxml2 libiconv libxslt```
4. installed my ruby version fresh (with rbenv)
5. did ```gem install bundler```
6. and ```bundle install``` ran without any problems.

`Nokogiri` was fine after that.

For reference:


╰─% cat .bundle/config
---
BUNDLE_PATH: vendor/bundle
BUNDLE_DISABLE_SHARED_GEMS: '1'
BUNDLE_JOBS: 4

╰─% which ruby bundle gem
~/.rbenv/shims/ruby
~/.rbenv/shims/bundle
~/.rbenv/shims/gem
Reply

#28
Just adding my voice to the crowd, but mkmf.log said something about not being able to find symbols for x86_64 architecture. I stumbled across this solution:

sudo env ARCHFLAGS="-arch x86_64" gem install nokogiri -- --use-system-libraries

May not solve anything for the original asker, but this may help someone.

Side Note: nokogiri has been my highest barrier to using ruby applications. Every time someone depends on a different version I have to figure out how to build it. And my problem is different every time.
Reply

#29
I got this issue when I upgraded my Mac OS to Yosemite. I was able to solve this issue by doing:

xcode-select --install
brew uninstall libiconv
brew install libiconv
gem install nokogiri

Reply

#30
This one worked for me

> sudo env ARCHFLAGS="-arch x86_64" gem install nokogiri:1.6.6.2 -- --use-system-libraries --with-xml=/usr/local/Cellar/libxml2/2.9.3/ --with-iconv-dir=/usr/local/Cellar/libiconv/1.14
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through