I had to clean my ruby gems because it was using a lot of space. So what were my options to get free space ? One single command to rule them all !
Here is a Windows command to uninstall all gems from your computer except a few one you cannot delete.
1 |
ruby -e "`gem list`.split(/$/).each { |line| puts `gem uninstall -Iax #{line.split(' ')[0]}` unless line.empty? }" |
On Linux, to remove ALL gems, that would be:
1 |
gem list | cut -d" " -f1 | xargs gem uninstall -aIx |
If you just want to clean your gem list and only keep the latest version of each gem, you can use this command
1 2 3 |
gem cleanup OR gem clean |
After your system is clean, you can chose to add one gem after another with the “gem install <mygemname>” command or use the “bundle install” in a rails app.
Don’t forget to install bundler before using the bundler installer !
1 |
gem install bundler |
Recent Comments