Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to uninstall all gems installed using `bundle install`

How can I remove all the gems installed using bundle install in a particular RoR project. I don't want to uninstall gems that are used by other projects.

like image 638
nish Avatar asked Jan 27 '14 15:01

nish


People also ask

How do I uninstall a gem bundle?

Installation and usage To install a prerelease version (if one is available), run gem install bundler --pre . To uninstall Bundler, run gem uninstall bundler .

How do I fix a run bundle to install missing gems?

In the invoked popup, start typing bundler, select bundle install and press Enter . 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 .


1 Answers

Since we're using ruby you could do something like this I guess:

bundle list | ruby -e 'ARGF.readlines[1..-1].each {|l| g = l.split(" ");  puts "Removing #{g[1]}"; `gem uninstall --force #{g[1]} -v #{g[2].gsub(/\(|\)/, "")}`; }' 

NOTE: Only lightly tested.

like image 148
rainkinz Avatar answered Sep 22 '22 10:09

rainkinz