x3z2ag
Last Updated: October 06, 2016
·
8.508K
· akalyaev
D83b63db79b42978fe35e120550ca180

Cleanup RVM

Part 1. RVM

Do not be surprised if one day you'll see something like this:

$ du -hs ~/.rvm
1.2G    /home/vagrant/.rvm

To solve the problem run rvm cleanup all. It will remove stale source folders / archives and other miscellaneous data associated with rvm.

$ rvm cleanup all
Cleaning up rvm archives
Cleaning up rvm repos
Cleaning up rvm src
Cleaning up rvm log
Cleaning up rvm tmp
Cleaning up rvm gemsets
Cleaning up rvm links
Cleanup done.
$ du -hs ~/.rvm
307M    /home/vagrant/.rvm

Well, much better now!

Part 2. Gemset

To cleanup outdated gems run rvm gemset empty [gemset]. It will remove all the gems, so you will need to run bundle install after that.

$ rvm gemset list

gemsets for ruby-2.0.0-p353 (found in /home/vagrant/.rvm/gems/ruby-2.0.0-p353)
=> (default)
   global
$ rvm gemset empty default
Are you SURE you wish to remove the installed gems for gemset 'ruby-2.0.0-p353' (/home/vagrant/.rvm/gems/ruby-2.0.0-p353)?
(anything other than 'yes' will cancel) > yes

There is a tip to empty all the gemsets.

Part 3. Global gem cachedir

Run rvm gemset globalcache enable (thanks to @mpapis). It will enable global gem cachedir, which will be used to store gems (we do not want to store the same gem for each Ruby version, obviously)

$ rvm gemset globalcache enable
Enabling global cache for gems.
Moving the gem cache for ruby-2.0.0-p353 to the global cache.

3 Responses
Add your response

11191
3ec52ed58eb92026d86e62c39bdb7589

do not forget - rvm gemset globalcache enable

over 1 year ago ·
15352
0f5366f21ef125a842f786c2995a084f

Cool tip.

I also like to use "rvm disk-usage all" for more details about rvm disk usage.

over 1 year ago ·
21948
38fac07694b5d75005e507607e502634

thanks :)

over 1 year ago ·