DEV Community

wusher
wusher

Posted on • Originally published at wusher.github.io on

Uninstall All Bundled Gems

I came across a quick way to delete all the gems installed through bundler. source

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(/\(|\)/, "")}`; }'

Enter fullscreen mode Exit fullscreen mode

Line by line version

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(/\(|\)/, "")}`
}'

Enter fullscreen mode Exit fullscreen mode

Top comments (0)