Ignoring GEM because its extensions are not built

98,711

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

Running gem pristine --all didn't help at first, but then I realized: the script I was running began with the line:

#!/usr/bin/ruby

On my macOS system (Catalina, but I don't think it matters), this points to the Ruby that came with the system, not the one installed by RVM. Running gem pristine --all was fixing up the RVM installation, but my script was calling a different version of Ruby.

The fix for me was to use the env command to call whichever Ruby is specified in the current shell's PATH. Changing the top line of the script to this fixed it:

#!/usr/bin/env ruby

Share:
98,711

Related videos on Youtube

Phillip Longman
Author by

Phillip Longman

Updated on November 13, 2021

Comments

  • Phillip Longman
    Phillip Longman about 1 year

    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.)
  • StevenNunez
    StevenNunez about 6 years
    This did it for me. rm -rf. I'd previously tried to pristine install all of my gems to no avail.
  • Sandro L
    Sandro L over 5 years
    This worked for me doing this only on the current ruby (I use rvm). Maybe this prevents someone from doing too much cleanup ;)
  • GDP2
    GDP2 almost 5 years
    Sometimes gem pristine --all will do no good. See this answer on Ask Different for more info.
  • Libby
    Libby almost 5 years
    Thanks for sharing the reboot tip. I had the same problem, on a Mac, and was able to resolve just by starting a new terminal session.
  • Chris Yim
    Chris Yim about 4 years
    if gem pristine --all has permission issues, you should check which ruby. brew link --overwrite ruby && source ~/.bash_profile and run gem pristine --all may help
  • Alex Cohen
    Alex Cohen about 4 years
    None of those solutions are working for me and I have this same issue.
  • rbanffy
    rbanffy over 3 years
    What OS are you talking about?
  • Dee Choksi over 3 years
    Just removing the rvm related stuff fixed this problem for me on macOS
  • Yacc
    Yacc almost 3 years
    rehash or hash -r for bash is a shell command available on *nix. When the C shell starts, it builds a hash table of all the commands in its path: each command name and its absolute pathname. So, after you start a csh running, if new programs are added to directories along the path, you need to use the shell's rehash command to rebuild its hash table. (cf: docstore.mik.ua/orelly/unix3/upt/ch27_06.htm)
  • AleGiovane over 2 years
    gem pristine --all put me into several toubles, I strongly recommend not to use it without care
  • Philippe Delteil
    Philippe Delteil about 2 years
    This solved my problem with msfconsole (aka metasploit)
  • Denis Arnaud
    Denis Arnaud almost 2 years
    Fantastic, that saved my day! I tried everything else mentioned before your answer, and it did not work. Only your procedure made it for me. Thanks!
  • omnikron about 1 year
    This fixed it for me too after switching to asdf from ruby-install & chruby
  • Ray Oei about 1 year
    THIS! The point is that even with rbenv I had this issue but I forgot using rbenv rehash so the internals were still pointing to the system Ruby (macos) instead of the fresh installed one... so much for reading ;-)
  • Ram Suthar about 1 year
    this fixed sudo rm -rf ~/.gem/ruby/
  • thisismydesign
    thisismydesign 11 months
    If you just want to get rid of the warnings it's faster to reinstall everything. gem pristine --all is very slow.
  • GDP2
    GDP2 11 months
    Note to self - also see this answer: apple.stackexchange.com/a/436672/79496

Related