Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails: Uninstall specific version of a library using gem

For example I have the following four versions installed:

capybara (2.2.1, 2.2.0.rc1, 2.1.0, 1.1.4)

Please suggest how to uninstall the capybara version 1.1.4

like image 462
Prashanth Sams Avatar asked May 27 '14 11:05

Prashanth Sams


People also ask

How do I install a specific version of a ruby gem?

Use `gem install -v` You may already be familiar with gem install , but if you add the -v flag, you can specify the version of the gem to install. Using -v you can specify an exact version or use version comparators.

What does gem cleanup do?

Description. The cleanup command removes old versions of gems from GEM_HOME that are not required to meet a dependency. If a gem is installed elsewhere in GEM_PATH the cleanup command won't delete it. If no gems are named all gems in GEM_HOME are cleaned.


2 Answers

When you do gem uninstall capybara it should give you a menu asking which one you want to uninstall.

Alternatively use the -v option.

gem uninstall capybara -v 1.1.4

Note you may need to sudo these commands if you're not using rvm.

like image 183
Max Williams Avatar answered Sep 30 '22 17:09

Max Williams


You can also uninstall gems with version requirements using this format:

gem uninstall 'my_gem:1.0.0'

So you in your case, you would have:

gem uninstall 'capybara:1.1.4'

This also works when you want to uninstall multiple gems:

gem uninstall 'my_gem:1.0.0' 'my_other_gem:2.0.0'

OR

gem uninstall 'my_gem:1.0.0' 'my_other_gem:~>2.0.0'

So you in your case, you would have:

gem uninstall 'capybara:1.1.4' 'capybara:2.1.40'

That's all.

I hope this helps

like image 34
Promise Preston Avatar answered Sep 30 '22 16:09

Promise Preston