39

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]

9 Answers 9

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
5
  • 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. Oct 9, 2014 at 15:40
  • it was happening for dozens of gems on my machine. i think they just had to be rebuilt Oct 10, 2014 at 6:00
  • For myself, I had to uninstall each gem that it was giving a warning for and then reinstall with bundle install Aug 24, 2016 at 18:59
  • 1
    "I was slaughtered" - wow.
    – B Seven
    Jan 6, 2017 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 Feb 10, 2019 at 12:51
63

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

I resolve such problem with: gem pristine --all

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

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.

5
  • 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, 2015 at 15:51
  • 1
    this should be the accepted answer Jun 24, 2016 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, 2016 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, 2018 at 6:50
  • Note to self - see my newer answer below for more details: apple.stackexchange.com/a/436672/79496
    – GDP2
    Feb 8 at 22:35
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.

1
  • This is what I were looking for MacOS Sierra solution. Thanks
    – Sakares
    Nov 11, 2016 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).

0

What this error means is that you cannot use the current version of the gem. It was installed with an older Ruby executable, and/or other system utilities and binaries have changed, making it such that you need to completely reinstall the gem again over from scratch. This happened to me when I migrated from Ruby 2.5.3 to Ruby 2.7.1. I had carried over all my gems from the previous version (via rvm migrate), but they were now broken. All my gems had to be rebuilt according to the 2.7.1 dependencies. So I had to completely remove all my gems via rvm gemset empty ruby-2.7.1. When that happens, it will print out a list of all your gems which were installed. Copy & paste that output into a safe file, which you can look back at again later to reinstall the gems you need to install a truly clean environment for your new Ruby version.

You must log in to answer this question.

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