Don’t trust the people on stackoverflow blindly

von tobonaut

Today I’ve learned again that you should never trust „solutions“ you’ll find on the net(e.g. on blindly. Even if it’s „the solution with the green checkmark beside it“. That only means that it worked somehow for the thread-creator. Please always evaluate the suggestion you’ve found and think about it or try to find out if it’s really a good solution.

Here is my example: I just wanted to install the nokogiri gem for a small project I started on my fresh installed mac-mini and got the following message:

Building nokogiri using packaged libraries.

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    /Users/meyer/.rvm/rubies/ruby-2.1.2/bin/ruby extconf.rb 
Building nokogiri using packaged libraries.
libiconv is missing.  please visit for help with installing dependencies.
*** 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.

After a bit of googling I came across the following stackoverflow thread that (if I would have trusted it blindly) would lead me to do stupid stuff like installing libiconv via homebrew and hard-link my gem build against this library. That’s „the solution with the green checkmark beside it“ in this case. But rather than this solution the cause of the problem is really simple and could be solved by installing a missing dependency:

xcode-select --install

This solution is mentioned in the comments below „the solution with the green checkmark beside it“ and is in my opinion the real solution for this problem and should get the green checkmark instead.

So please: don’t stop thinking and don’t just copy stuff from the net ;-)

Note: even the link to the official page of nokogiri provided in the error message told me to do strange stuff what is very disappointing :-(