40

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 Answers9

63

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

I resolve such problem with: gem pristine --all

skywinder
  • 1,681
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.

Mic92
  • 321
  • 2
  • 4
  • 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 08 '15 at 15:51
  • 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 06:50
  • Note to self - see my newer answer below for more details: https://apple.stackexchange.com/a/436672/79496 – GDP2 Feb 08 '22 at 22:35
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 09 '14 at 15:40
  • it was happening for dozens of gems on my machine. i think they just had to be rebuilt – random-forest-cat Oct 10 '14 at 06: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
  • 1
    "I was slaughtered" - wow. – B Seven Jan 06 '17 at 00: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 '19 at 12:51
5

I fixed this by:

rvm get stable

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

Raj
  • 153
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.

Javad
  • 571
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

skozz
  • 101
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).

mrtnmgs
  • 111
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.

GDP2
  • 1,328
  • 15
  • 24