36

Every few days this will happen when doing various things in Ruby CLI (notably, using the knife utility for Chef) on OS X (unable to replicate in other environments; Linux, FreeBSD, etc.):

Ignoring bcrypt-3.1.7 because its extensions are not built.  Try: gem pristine bcrypt-3.1.7
Ignoring bigdecimal-1.2.5 because its extensions are not built.  Try: gem pristine bigdecimal-1.2.5
Ignoring ffi-yajl-1.1.0 because its extensions are not built.  Try: gem pristine ffi-yajl-1.1.0
Ignoring gem-wrappers-1.2.5 because its extensions are not built.  Try: gem pristine gem-wrappers-1.2.5
Ignoring gem-wrappers-1.2.4 because its extensions are not built.  Try: gem pristine gem-wrappers-1.2.4
Ignoring pg-0.17.1 because its extensions are not built.  Try: gem pristine pg-0.17.1
Ignoring psych-2.0.6 because its extensions are not built.  Try: gem pristine psych-2.0.6
Ignoring sqlite3-1.3.9 because its extensions are not built.  Try: gem pristine sqlite3-1.3.9

And while it's a simple fix, it keeps happening. Has anyone come across this before?

$ ruby -v
ruby 1.9.3p484 (2013-11-22 revision 43786) [x86_64-darwin11.2.0]
5

I recently switched to from rvm to chruby and ran gem update --system, thats when the issue began occurring for me. After that, anytime I ran bundle I was slaughtered with the same warnings. Still not sure which caused the issue.

Ignoring curb-0.8.6 because its extensions are not built. Try: gem pristine curb-0.8.6

Not sure what fixed it, but I did 2 things and the warning disappeared:

gem uninstall bundler
gem install bundler

gem install curb
  • Oddly enough, it started for me when I switched from the OS X-bundled Ruby to RVM. Generally, it clears on its own after a few days or if I open a new session (which is sort of a hassle when it occurs midday). I generally have to reinstall whatever I'm using at a given time, and that is usually Knife. – tony_perkis666 Oct 9 '14 at 15:40
  • it was happening for dozens of gems on my machine. i think they just had to be rebuilt – lfender6445 Oct 10 '14 at 6:00
  • For myself, I had to uninstall each gem that it was giving a warning for and then reinstall with bundle install – Noah Passalacqua Aug 24 '16 at 18:59
  • "I was slaughtered" - wow. – B Seven Jan 6 '17 at 0:45
  • Whatever I try I get You don't have write permissions for the /Library/Ruby/Gems/2.3.0 directory, those issues started on their own, I'm not even using ruby for all I know. But I get errors about extensions not built for clocale-0.0.3 whenever I start a new shell – Vadorequest Feb 10 at 12:51
62

In my case I start to see this errors after installing rvm

I resolve such problem with: gem pristine --all

  • what a useful command – lfender6445 Jan 6 '15 at 1:20
  • 2
    This worked... But I have no idea why – Hubro Sep 7 '15 at 7:16
  • 1
    uninstalling bundler and installing did not work. But this one worked! Thanks! – Srikanth Jeeva Sep 8 '15 at 20:54
  • 3
    This should have been the accepted answer. – ILikeTurtles Feb 2 '16 at 19:05
19

This problem occurs, if a gem was compiled against a different libruby as the currently running. For example, if one uses a ruby located in his home directory with chruby and installs gems to ~/.gem/ruby, but runs a script which calls /usr/bin/ruby, which reuses the gems installed there. In this case gem pristine --all will not help, because the gems can be linked only against one ruby version.

  • Ahhhh thank you! I was getting that error when running "rails s". I switched to "bundle exec rails s" and the problem vanished. – Gerry Apr 8 '15 at 15:51
  • 1
    this should be the accepted answer – Dominik Schreiber Jun 24 '16 at 8:20
  • 1
    This answer is right. If the problem happens in a Rails repository where gems are saved in vendor/bundle, just delete them with rm -rf vendor/bundle and reinstall them with bundle install. – vmarquet Jun 25 '16 at 18:42
  • Thank you. I tried gem pristine --all till I was blue in the face and now I know why it didn't work... – GDP2 Jan 29 '18 at 6:50
5

I fixed this by:

rvm get stable

https://github.com/rvm/rvm/issues/3348

2

This worked for me on MacOs Sierra:

xcode-select --install
gem install nokogiri

I already had installed the entire xcode prior to running the above commands, but I had to do this anyways, perhaps because the first script updates some internal libraries/dependencies.

  • This is what I were looking for MacOS Sierra solution. Thanks – Sakares Nov 11 '16 at 4:34
1

Make sure you're running "gem pristine --all" for the right version of ruby. If /usr/bin/ruby is being called... use "/usr/bin/gem pristine --all". This is not obvious if you're using rvm and you have 10 versions of ruby installed.

This fixed my problem for a day and then it came back.

What seems to be a more permanent solution is to do "rvm reset" to have the default ruby be the installed OSX version /usr/bin/ruby and /usr/bin/gem. If I want to use a newer version of ruby for a project I use .ruby-version and .ruby-gemset in the project root directory to explicitly set the version of ruby I want to use. Not ideal... but it should make this error go away.

0

In my case:

rvm get stable

sudo gem pristine --all

0

I am very new to rails so this might be completely misguided advice but since none of the other solutions worked for me I thought I'd share mine.

Mic92 and Gerry put me on the right track: I was using rails s which can cause errors because it runs a rails version that can be a different version than the project's.

I tried to connect with bin/rails server, I got a different error (missing gems) so I ran bundle install

At this point I got a third error ("incompatible library version"), which spring stop cured.

Then I ran rails generate controller again, spring restarted and everything worked (I cried a little).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .