Using RVM for quite some time? You should clean it up a bit

I can't even remember the last time I ran rvm implode, I'd reckon I've been using RVM for about three years.

Sure: I always update it via rvm get stable but I never really clean up old Rubys or gems, I only run bundle clean --force in each repository from time to time since I don't always use bundle exec.

In any case, time to see how much space it eats up on macOS via rvm disk-usage all:

  Downloaded Archives Usage: 1.3M
  Repositories Usage: 0B
  Extracted Source Code Usage: 5.2M
  Log Files Usage: 28K
  Packages Usage: 0B
  Rubies Usage: 298M
  Gemsets Usage: 11G
  Wrappers Usage: 212K
  Temporary Files Usage: 0B
  Other Files Usage: 5.6M
  Total Disk Usage: 11G

Eleven gigabytes of gems, sources, caches and various paraphernalia, wow, that's something. Let's try to clean this up a bit:

Step one

Always update RVM to its latest stable release:

$ rvm get stable

Step two

Share the gem cache with all Ruby versions (note this might introduce some subtle bugs if you like to edit your gems like me for debug purposes):

$ rvm gemset globalcache enable

Step three (attention destructive)

Run this simple script by kugaevsky to further clean up your gems.

Note:

This process could be too destructive sometimes and you may need to run 'bundle' command from your project directory.

Step four

Let RVM clean-up after itself:

rvm cleanup Lets you remove stale source folders / archives and other

$ rvm cleanup all

Note: this will take some time to complete.

Results

$ rvm 
  " .etc
  Total Disk Usage: 9.0G

Not bad (let's keep in mind that I did not remove any gemsets or Ruby installs and for my main projects I didn't need to run bundle after running kugaevsky's script).

Btw. if you're using a VM for development you can try this afterwards to further reduce its size.

Credits:

Tagged under: