When I try to cleanup my rails versions with sudo gem cleanup rails
I get the following error:
Cleaning up installed gems...
Attempting to uninstall rails-2.3.5
Unable to uninstall rails-2.3.5:
Gem::InstallError: cannot uninstall, check `gem list -d rails`
Attempting to uninstall rails-1.2.6
Unable to uninstall rails-1.2.6:
Gem::InstallError: cannot uninstall, check `gem list -d rails`
gem list -d rails
results in:
rails (2.3.8, 2.3.5, 1.2.6)
Author: David Heinemeier Hansson
Rubyforge: http://rubyforge.org/projects/rails
Homepage: http://www.rubyonrails.org
Installed at (2.3.8): /Library/Ruby/Gems/1.8
(2.3.5): /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8
(1.2.6): /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8
Web-application framework with template engine, control-flow layer,
and ORM.
Any one know what's wrong?
Select Tools | Bundler | Install from the main menu. Open the Gemfile, place the caret at any highlighted gem missing in the project SDK and press Alt+Enter . Select Install missing gems using 'bundler' and press Enter .
To check if a specific version is installed, just add --version , e.g.: gem list -i compass --version 0.12.
A Gemfile is a file that is created to describe the gem dependencies required to run a Ruby program. A Gemfile should always be placed in the root of the project directory.
After some long searches it turns out the reason is because of a non-existent path. The cannot uninstall comes up because the system doesn't search /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8
On a granular level, instead of gem cleanup rails
, you can simply use the uninstall command and type:
gem uninstall rails -i /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8
Then you might hit another problem related to a non-existent path, at which point, you should create a directory using the command:
mkdir /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/bin
Now all uninstalls should work well. I recommend doing a clean gem reinstall by performing the following functions:
gem list --no-versions | sed -e '/^(*|$)/d' > installed_gems
gem list | cut -d" " -f1 | xargs gem uninstall -aIx
cat installed_gems | xargs sudo gem install
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With