Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ignoring GEM because its extensions are not built

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.


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.


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

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.


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.