Ignoring GEM because its extensions are not built

On both my work and home computers, I recently upgraded Ruby to 2.3.1, using ruby-install. I use chruby as my Ruby switcher.

I started seeing this warning in my terminal:

Ignoring bcrypt-3.1.11 because its extensions are not built.  Try: gem pristine bcrypt --version 3.1.11
Ignoring bcrypt-3.1.10 because its extensions are not built.  Try: gem pristine bcrypt --version 3.1.10
Ignoring binding_of_caller-0.7.2 because its extensions are not built.  Try: gem pristine binding_of_caller --version 0.7.2
Ignoring byebug-9.0.5 because its extensions are not built.  Try: gem pristine byebug --version 9.0.5
Ignoring byebug-5.0.0 because its extensions are not built.  Try: gem pristine byebug --version 5.0.0
Ignoring concurrent-ruby-ext-1.0.2 because its extensions are not built.  Try: gem pristine concurrent-ruby-ext --version 1.0.2
Ignoring debug_inspector-0.0.2 because its extensions are not built.  Try: gem pristine debug_inspector --version 0.0.2

On my work, computer, the list was much longer, but easy to resolve. When I tried the suggested gem pristine GEM, it told me it couldn't find the gem, so I ran gem install GEM, and that solved it.

At home, nothing is working.

Things I have tried, from common sense and various other Stack questions:

  • gem pristine GEM
  • gem pristine --all
  • uninstalling and reinstalling the gem
  • gem update
  • gem update --system
  • bundle update
  • uninstalling and reinstalling bundler
  • uninstalling and reinstalling rails (Though, it's not a Rails specific problem.)
  • deleting ~/.bundle/
  • opening XCode and letting it install some extensions (It did need to do it, but it didn't fix anything.)
  • running brew doctor and solving all the minor issues, then brew update and brew upgrade
  • gem install curb (I can't imagine what this gem has to do with this issue, but two different people listed it as the last step of their fix to the same warning.)

Solution 1:

I came across this exact issue today - getting warnings like this for gems that weren't even installed!

... Well, it turns out the gems were installed - for a different ruby than the one I had set active with chruby (2.2.3 vs 2.3.1).

Switching to all the different rubies and running gem pristine --all on all of them solved the problem.

Solution 2:

I ran into this issue and followed all the same commands as above, even going so far as to remove all my previously installed Ruby versions. However, the error persisted.

Turns out, there were some leftover gems for the various (previously uninstalled) versions in ~/.gem/ruby/. After removing the folders I no longer used, the errors disappeared.

Solution 3:

I've had this problem today too and it frustrated because I couldn't type because my whole editor flashed red with error messages.

I'm not entirely sure what exactly caused it but I believe it's because we have multiple ruby versions OR multiple ruby version managers installed and they overwrite each other and otherwise mess up your paths towards the gems.

The gem command also gets overwritten when you have rbenv and rvm.

See which ones you've installed by typing;

which rvm
which rbenv
which chruby

If one of those is installed it'll return a path. Then delete them, make sure to completely clean out all the directories and start with a clean install.


Remove

Here's what I did for rvm;

rvm implode
gem uninstall rvm
rm -rf ~/.rvm
rm -rf ~/.rvmrc

Here's what I did for rbenv

First installed https://github.com/meowsus/rbenv-clean, then

rbenv clean
sudo apt-get remove rbenv
rm -rf ~/.rbenv

Reinstall

Then you have a clean home directory to work from. I reïnstalled rbenv with How to install Ruby 2.1.4 on Ubuntu 14.04. And finally;

rbenv rehash

Solution 4:

I did everything mentioned above including

  • xcode-select --install
  • reinstall ruby
  • reinstall all gems
  • gem pristine --all

but the issue was the same for me. I just rebooted my Mac as the last hope, and the warning messages are disappeared.

Weird, but if anyone's struggling with this issue after trying everything on StackOverflow, try reboot your machine.

Solution 5:

Adding my own flavor here. I use rbenv installed via Homebrew and was getting four of these "ignoring... extensions not built" messages. Specifically:

Ignoring bcrypt-3.1.12 because its extensions are not built.  Try: gem pristine bcrypt --version 3.1.12
Ignoring bindex-0.5.0 because its extensions are not built.  Try: gem pristine bindex --version 0.5.0
Ignoring bootsnap-1.3.2 because its extensions are not built.  Try: gem pristine bootsnap --version 1.3.2
Ignoring byebug-10.0.2 because its extensions are not built.  Try: gem pristine byebug --version 10.0.2

I tried many things in this thread with no luck. Finally in my case I did:

  • brew uninstall rbenv
  • rm -rf ~/.rbenv
  • brew install rbenv

At this point I was still getting the errors, but now I had only a single Ruby version to contend with:

$ rbenv versions
* system (set by /Users/will/.rbenv/version)

At this point I tried sudo gem pristine --all but was rejected for permissions on the system Gems directory.

So I went through and ran pristine on each gem, like

sudo gem pristine bcrypt --version 3.1.12 (etc)

And finally the errors were gone.