ruby 2.1.0 installed currently and I want to move forward with any gems I install for this version of ruby.
However I also have the system (OSX 10.9) default ruby (1.8.x) and I had previously installed some gems for that version. I can see them here:
I have no idea how to get
gem to properly uninstall from the above dir so I can clean my machine up and reinstall newer versions of some of those gems for my
rbenv managed newer version of ruby.
For example, I had installed Compass and Sass for 1.8.x, I don't need Compass any longer and would like it removed from my machine and would like to upgrade Sass from 3.2 to 3.3 but have it run off ruby 2.1.0.
gem list gives me only the currently installed gems for my active version of ruby set by
rbenv, which makes total sense.
So how can I run
gem uninstall <old ruby 1.8.x gem> found at
rbenv allows you to switch to your system version of Ruby by running:
rbenv global system
Then uninstall gems using:
sudo gem uninstall -aIx
If the 'sudo gem uninstall -aIx' fails, it's likely because your gem version is too old. You can then run
gem list to print out all of the gems installed to your system Ruby.
sudo gem uninstall [gem name]
on the ones that you would like to remove. You should never have to run sudo on a gem install/uninstall, but since you had to use it to install gems to the system version of Ruby, it's the only way you're going to get them out of there.
My system Ruby is 2.0, so your default gems might be different, but by default I have the following preinstalled. It's not a big deal if you accidentally try to delete the wrong one, as it'll just warn you that it can't uninstall default gems.
bigdecimal (1.2.0) io-console (0.4.2) json (1.7.7) minitest (4.3.2) psych (2.0.0) rake (0.9.6) rdoc (4.0.0) rubygems-update (2.5.1) test-unit (18.104.22.168)
After that, remember to switch back to your rbenv version of Ruby.
rbenv list rbenv global 2.1.0 # or whichever version you have installed
From there you can check your Ruby version and install gems like so:
ruby -v #=> ruby 2.1.0-p648 (2015-12-16 revision 920553) [x86_64-darwin15] gem install [gem name] # installs to currently set version of Ruby from running ruby -v