Ignoring GEM because its extensions are not built

RubyRubygemsChruby

Ruby Problem Overview


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.)

Ruby Solutions


Solution 1 - Ruby

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 - Ruby

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 - Ruby

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 https://stackoverflow.com/questions/26595620/how-to-install-ruby-2-1-4-on-ubuntu-14-04. And finally;

rbenv rehash

Solution 4 - Ruby

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 - Ruby

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.

Solution 6 - Ruby

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

Solution 7 - Ruby

In my case the warning itself has suggested the solution , so I just run them one by one.

Ignoring bigdecimal-2.0.0 because its extensions are not built. Try: gem pristine bigdecimal --version 2.0.0
Ignoring date-3.0.1 because its extensions are not built. Try: gem pristine date --version 3.0.1
Ignoring dbm-1.1.0 because its extensions are not built. Try: gem pristine dbm --version 1.1.0
Ignoring etc-1.1.0 because its extensions are not built. Try: gem pristine etc --version 1.1.0

Here an example:

gem pristine bigdecimal --version 2.0.0

so running the command of each line has solved my problem.

Solution 8 - Ruby

If you have installed RVM, possible you're catching the error because you have installed different versions.

Check and remove useless versions, but I think this is not good approach. Anyway errors gone.

rvm list
rvm use ruby-version
rvm remove ruby-useless-version

After refresh cocoapods, it should be injected in .rvm GEM_HOME

gem uninstall cocoapods
gem install cocoapods

Probably pod COMMAND will throw the error about minitest gem, so – gem install minitest

Solution 9 - Ruby

If the Ruby directory is invoked or environment vars point to a symlink'ed directory, or are copied or renamed, this message is likely. I am using chruby and was symlinking /opt/rubies/ -> /usr/local/ruby/, but Ruby's dynamic library-finding logic doesn't play well with this.

The solution in my case was to replace the symlink with actual rubies in /opt/rubies/ and run gem pristine --all in each Ruby. For others using RVM or Rbenv, good luck with that without starting over from scratch.

This may not be your exact issue, but hopefully it helps.

Solution 10 - Ruby

Running Mac OS Catalina, brew and rbenv ...

Having come across this exact problem today, and gone through all the answers here I eventually stumbled across another reason for this error:

Ignoring nokogiri 1.10.7 because its extensions are not built. Try: gem pristine nokogiri --version 1.10.7

And of course gem pristine did no work.

My problem was a hard coded GEM_HOME and GEM_PATH environment variables which were overriding rbenv.

So, check that you haven't set GEM_PATH and GEM_HOME in ~/.zshrc

Solution 11 - Ruby

Most comments here are on the right track. This problem often occurs after a Ruby version upgrade. I reviewed the gem command code and here is the gist of it.

Extensions are compiled into the gems/gem/ext subdirectory of the gems home directory. For example, on my Cygwin installation (and similarly under Raspbian), the BigDecimal extension is compiled into /usr/share/gems/gems/bigdecimal-1.3.5/ext/bigdecimal/bigdecimal.so.

However, this is not where the extension is referenced when executed - that is from /usr/lib/gems/ruby/ver/gem. Again using BigDecimal, the extension file when executed is loaded from /usr/lib/gems/ruby/2.3.0/bigdecimal-1.3.5/bigdecimal.so

Here is the key: in this same directory, there is an empty tag file /usr/lib/gems/ruby/2.3.0/bigdecimal-1.3.5/gem.build_complete

When the gem command starts up, it refers to the gems/specifications directory to get a list of installed gems and information as to whether they have extensions. If a gem does have extensions, gem (among other sanity checks) looks for the tag file gem.build_complete. If that is not found, it emits the error message "Ignoring gem because its extensions are not built".

Any action which rebuilds all extensions will fix this problem. Or, as total hack, if you in a hurry and brave, you can try copying all contents of /usr/lib/gems/ruby/oldver to /usr/lib/gems/ruby/newver e.g.

cd /usr/lib/gems/ruby
cp -nv 2.3.0/* 2.6 

Solution 12 - Ruby

Libby's suggestion to just start a new terminal session (which she commented on Sebastian Kim's answer) worked for me. Much quicker than any of the others too so I wanted to make it an answer so it was more visible.

Solution 13 - Ruby

This is an old thread, but I just came across this issue myself.

You don't need to restart your machine, you just need to refresh your environment, you can do this with the rehash command:

rehash

From the man page: rehash command re-computes the internal hash table of the contents of directories listed in the path environmental variable to account for new commands added.

Solution 14 - Ruby

This is also a problem when you're developing on Mac and then build a Docker image: https://forums.aws.amazon.com/thread.jspa?messageID=879802&tstart=0 > When you do a "bundle install --deployment", bundler will create a > vendor directory w/ your gems in it. Note that whilst this includes > your gems in the local folder, it will only include the native > extensions for your platform. As you're on macOS this will be Darwin. > You'll need to do repeat the process on a 64-bit x86 linux > environment.

Solution 15 - Ruby

I had this problem but only when I was starting tmux session using tmuxinator.

Turned out it's because I'm using tmuxinator from brew instead of installing it using gem install. Maybe using chruby at the same time contributed to the problem as well.

p/s: I also removed unused ruby from ~/.gem/ruby but I doubt that's the reason this issue was resolved for me.

Solution 16 - Ruby

Uninstall and reinstall of Vagrant also works. There's an unistall.tool bash script included in the installer .dmg image that will remove Vagrant.

Found this solution here: https://stackoverflow.com/questions/40891428/updating-vagrant-and-gems-extentions-not-built-in

Solution 17 - Ruby

I had the same issue and I'm using rbenv. For some reason my global rbenv setting went missing. In order to fix this problem I set the global version to one of my rbenv versions... for instance:

rbenv global 2.5.1

Solution 18 - Ruby

On my case I was trying to run pristine --all but I was getting:

Ignoring ffi-1.11.1 because its extensions are not built.  Try: gem pristine ffi --version 1.11.1
Ignoring jaro_winkler-1.5.3 because its extensions are not built.  Try: gem pristine jaro_winkler --version 1.5.3
Ignoring psych-3.1.0 because its extensions are not built.  Try: gem pristine psych --version 3.1.0
/.rbenv/versions/2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require': incompatible library version - /.gem/gems/psych-3.1.0/lib/psych.bundle (fatal) 

Then, I deleted the content on Users/{{user.name}}⁩/⁨.gem⁩ then as I needed to run bundle install --force, it reinstalled everything, then the command pristine --all worked as expected

Solution 19 - Ruby

This solution worked for me for RubyMine IntelliJ

I had two different terminals being used and RVM and ruby<Version>.

Solution:

I had to switch it to the RVM version for the errors to go away in Preferences>Languages&Frameworks>Ruby SDK

Errors:

Ignoring executable-hooks-1.6.0 because its extensions are not built. Try: gem pristine executable-hooks --version 1.6.0 rubymine

Ignoring gem-wrappers-1.4.0 because its extensions are not built. Try: gem pristine gem-wrappers --version 1.4.0

enter image description here

Solution 20 - Ruby

If you are using rvm like me, the fix could a simple:

rvm get stable
rvm reload

As stated in this answer https://apple.stackexchange.com/a/192513

Solution 21 - Ruby

I have executed these commands in Terminal and worked for me:

  1. /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  2. brew install ruby, it may need sudo (sudo brew install ruby).
  3. echo 'export PATH="/usr/local/opt/ruby/bin:$PATH"' >> ~/.bash_profile
  4. source ~/.bash_profile
  5. sudo gem pristine --all

Solution 22 - Ruby

In Ubuntu this worked for me.

  1. source ~/.bash_profile
  2. sudo gem pristine --all

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionPhillip LongmanView Question on Stackoverflow
Solution 1 - RubysevenseacatView Answer on Stackoverflow
Solution 2 - RubyopesView Answer on Stackoverflow
Solution 3 - RubySimon SomlaiView Answer on Stackoverflow
Solution 4 - RubySebastian KimView Answer on Stackoverflow
Solution 5 - RubywrydereView Answer on Stackoverflow
Solution 6 - RubyDave CeddiaView Answer on Stackoverflow
Solution 7 - RubyMarwen DoukhView Answer on Stackoverflow
Solution 8 - RubydimpiaxView Answer on Stackoverflow
Solution 9 - Rubyuser246672View Answer on Stackoverflow
Solution 10 - RubyTomm PView Answer on Stackoverflow
Solution 11 - RubyLex LindseyView Answer on Stackoverflow
Solution 12 - RubyjimView Answer on Stackoverflow
Solution 13 - RubyYaccView Answer on Stackoverflow
Solution 14 - RubyNorseGaudView Answer on Stackoverflow
Solution 15 - RubyAmreeView Answer on Stackoverflow
Solution 16 - RubyJeff WigalView Answer on Stackoverflow
Solution 17 - RubyEric JonesView Answer on Stackoverflow
Solution 18 - RubyLuisa HernándezView Answer on Stackoverflow
Solution 19 - RubyRoger PerezView Answer on Stackoverflow
Solution 20 - RubylucasarrudaView Answer on Stackoverflow
Solution 21 - RubyMrDEVView Answer on Stackoverflow
Solution 22 - RubyMark RuttoView Answer on Stackoverflow