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.)
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
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.
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.
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
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.
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
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
TL;DR - Ruby gems don't like Rubies running from symlinks or moved from where they were built (because of embedded shebangs)
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.
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.
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
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.
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.
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.
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: Updating Vagrant and Gems Extentions Not Built In
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
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
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
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
I have executed these commands in Terminal and worked for me:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install ruby, it may need sudo (sudo brew install ruby).
echo 'export PATH="/usr/local/opt/ruby/bin:$PATH"' >> ~/.bash_profile
source ~/.bash_profile
sudo gem pristine --all
In Ubuntu this worked for me.
source ~/.bash_profile
sudo gem pristine --all
For some gems on my machine, there are multiple versions:
$gem list bigdecimal
bigdecimal (1.2.6, 1.2.5)
$gem list io-console
io-console (0.4.3, 0.4.2)
$gem list json
json (1.8.2, 1.8.1)
...
I want to remove the old versions. I tried several commands:
$gem cleanup
Cleaning up installed gems...
Clean Up Complete
$sudo gem cleanup
Cleaning up installed gems...
Clean Up Complete
$gem cleanup json
Cleaning up installed gems...
Clean Up Complete
$sudo gem cleanup json
Cleaning up installed gems...
Clean Up Complete
but the old versions are not removed. Why are the old versions not detected by cleanup? How can I remove them?
Update Strange thing is that, I can manually uninstall the newer versions but not the old ones. For example,
$ sudo gem uninstall json --version 1.8.1
ERROR: While executing gem ... (Gem::InstallError)
gem "json" cannot be uninstalled because it is a default gem
$ sudo gem uninstall json --version 1.8.2
Successfully uninstalled json-1.8.2
Update What is a default gem? Why can't it be deleted?
Update If I have a default old version, does it mean that a newer version is not in use and the default one is called by the command require?
It's likely that gem cleanup isn't working because you have something installed with dependencies on these old versions. You can check what has dependencies on your old gems by running gem dependency your-gem-name --reverse-dependencies.
If that command doesn't show you any dependencies you can manually remove the old versions with gem uninstall:
# remove specific version
gem uninstall your-gem-name --version 2.1.0
# remove all versions less than a certain version
gem uninstall your-gem-name --version '<2.1.0'
Strange... but this is what I got :
$ gem list | grep rvm
>> rvm (1.11.3.3)
$ gem uninstall rvm
>> INFO: gem "rvm" is not installed
How can that be possible? The root of this problem probably stems from me downloading the latest RVM and finding that it does not work with the latest version of POW. Thus I had to implode RVM and reinstall an older version. Since then when I do a cap deploy, I get the classic :
`<top (required)>': RVM - Capistrano integration was extracted to a separate gem, install: `gem install rvm-capistrano` and remove the `$LOAD_PATH.unshift` line, note also the 'set :rvm_type, :user' is now the default (instead of :system). (RuntimeError)
Any ideas?
I recently encountered the same rvm error:
"RVM - Capistrano integration was extracted to a separate gem, install: gem install rvm-capistrano and remove the $LOAD_PATH.unshift line, note also the 'set :rvm_type, :user' is now the default (instead of :system). (RuntimeError)"
Doing what the error suggested did not work for me at all.
What did work for me was to do: rvm -v
When I did this I saw that my rvm version was rvm 1.13.0
Using "rvm get" I did "rvm get 1.12.0" but still got the error
Then I tried "rvm get 1.11.0" and then presto, my rvm started working again.
I'm not 100% sure what caused the error in the first place but I think it all began when I tried to upgrade rvm with rvm get stable after I was unable to install some gems. I found out that I wasn't able to install gems anymore due to the fact that I had updated my xcode to 4.3.2 and apparently Apple changed their c complier which doesn't play nice with rvm.
Hope this helps someone.
Are you in a gemset? If so, that gem might be in the interpreter's unnamed gemset or the global gemset. If so, try
rvm use 1.9.3
gem uninstall rvm
or
rvm use 1.9.3#global
gem uninstall rvm
I just ran into this error as well. The error you ran into was because of the recent capistrano update. If you add rvm-capistrano to your gemfile and remove the $LOAD-PATH.unshift line from your capistrano deployment file it should work, at least it did for me.
That would be correct. Its in the 'global' gemset. This gemset is 'mixed in' to both the 'default' gemset and any gemsets you actually create.
Thus if you have Ruby 1.9.3 installed, for example, (rvm install 1.9.3) it will be installed into that ruby's 'global'. You can verify this by doing 'gem list rvm -dl' which will show you the name, version, description, and location on the disk of the requested gem.
∴ gem list rvm -dl
*** LOCAL GEMS ***
rvm (1.11.3.3)
Authors: Wayne E. Seguin, Michal Papis
Homepage: https://rvm.beginrescueend.com/
Installed at: /home/me/.rvm/gems/ruby-1.9.3-p194#global
RVM Ruby Gem Library
∴
I don't know why you want it removed, but you would do as Abe stated as the second choice.
To give more details, RVM works with POW, this is known issue: https://github.com/37signals/pow/issues/271
the easiest solution(in project dir):
rvm env . > .powenv
The version of RVM might not be compatible with POW. You can remove RVM and then install the most current version.
The problem is that RVM 1.12 and up does not play well with Capistrano.
So uninstall your RVM, then get RVM 1.11 (rvm get 1.11.0).
Nathan got it right: https://stackoverflow.com/a/10306090/294449
You used to have to do the unshift in your deploy.rb but the latest versions of RVM have made that hack no longer necessary. Just remove it and add the rvm-capistrano gem to your Gemfile. It works like a charm.
I had tons of gems on my local machine which I were installed before and after RVM, so I decided to wipe them all and reinstall. Everything seemed to go ok, except bundler:
gem list
.....
bundler (1.1.3, 1.0.22)
I don't know why 1.0.22 is still there, and I can't figure out how to get rid of it!
$ gem cleanup
Cleaning up installed gems...
Attempting to uninstall bundler-1.0.22
Unable to uninstall bundler-1.0.22:
Gem::InstallError: gem "bundler" is not installed
Clean Up Complete
$ gem uninstall bundler-1.0.22
INFO: gem "bundler-1.0.22" is not installed
UPDATE 1
Path info as requested by Andrew
/Users/brandon/.rvm/gems/ruby-1.9.3-p125-perf#global/gems/bundler-1.0.22/
What's most likely happening is that the two versions of Bundler are installed in two different gemsets, one of which is inheriting from the other. 1.0.22 is probably installed in the global gemset (rvm use #global), or "root" gemset (rvm use <ruby_version>). Once you're in the gemset that has 1.0.22 installed, you should be able to remove it with gem uninstall bundler.
I have several versions of a Ruby gem:
$ gem list
rjb (1.3.4, 1.3.3, 1.1.9)
How can I remove old versions but keep the most recent?
# remove all old versions of the gem
gem cleanup rjb
# choose which ones you want to remove
gem uninstall rjb
# remove version 1.1.9 only
gem uninstall rjb --version 1.1.9
# remove all versions less than 1.3.4
gem uninstall rjb --version '<1.3.4'
For removing older versions of all installed gems, following 2 commands are useful:
gem cleanup --dryrun
Above command will preview what gems are going to be removed.
gem cleanup
Above command will actually remove them.
Way to clean out any old versions of gems.
sudo gem cleanup
If you just want to see a list of what would be removed you can use:
sudo gem cleanup -d
You can also cleanup just a specific gem by specifying its name:
sudo gem cleanup gemname
for remove specific version like 1.1.9 only
gem uninstall gemname --version 1.1.9
If you still facing some exception to install gem, like:
invalid gem: package is corrupt, exception while verifying: undefined method `size' for nil:NilClass (NoMethodError) in /home/rails/.rvm/gems/ruby-2.1.1#project/cache/nokogiri-1.6.6.2.gem
the, you can remove it from cache:
rm /home/rails/.rvm/gems/ruby-2.1.1#project/cache/nokogiri-1.6.6.2.gem
For more detail:
http://blog.grepruby.com/2015/04/way-to-clean-up-gem-or-remove-old.html
Try something like gem uninstall rjb --version 1.3.4.
gem cleanup uses system commands. Installed gems are just directories in the filesystem. If you want to batch delete, use rm -R.
gem environment and note the value of GEM PATHS
cd <your-gem-paths>/gems
ls -1 |grep rjb- |xargs rm -R
You might need to set GEM_HOME for the cleanup to work. You can check what paths exist for gemfiles by running:
gem env
Take note of the GEM PATHS section.
In my case, for example, with gems installed in my user home:
export GEM_HOME="~/.gem/ruby/2.4.0"
gem cleanup
bundler clean
Stopped the message showing for me, as a last step after I tried all of the above.