在Ruby Version Manager(RVM)中清理旧的引用

时间:2021-09-10 07:24:22

I need to free disk space on my local machine, which is almost allocated into my Ruby Version Manager (RVM) dir.

我需要释放本地计算机上的磁盘空间,这几乎分配到我的Ruby版本管理器(RVM)目录中。

Now, it seems I got just one ruby version ( 1.9.2p136 ) :

现在,我似乎只有一个ruby版本(1.9.2p136):

lsoave@ubuntu:~/rails/github/gitwatcher$ ruby -v
ruby 1.9.2p136 (2010-12-25 revision 30365) [i686-linux]
lsoave@ubuntu:~/rails/github/gitwatcher$ 

lsoave@ubuntu:~/rails/github/gitwatcher$ rvm list
rvm rubies
=> ruby-1.9.2-p136 [ i386 ] 
lsoave@ubuntu:~/rails/github/gitwatcher$

lsoave@ubuntu:~/rails/github/gitwatcher$ which ruby
/home/lsoave/.rvm/rubies/ruby-1.9.2-p136/bin/ruby
lsoave@ubuntu:~/rails/github/gitwatcher$ 

but my RVM dir, have many others unrelated dirs/versions :

但我的RVM目录,有许多其他无关的目录/版本:

lsoave@ubuntu:~/rails/github/gitwatcher$ ls -la ~/.rvm/gems
total 72
drwxr-xr-x 18 lsoave lsoave 4096 2011-05-21 15:44 .
drwxr-xr-x 23 lsoave lsoave 4096 2011-02-10 22:46 ..
drwxr-xr-x  2 lsoave lsoave 4096 2010-08-29 19:50 cache
drwxr-xr-x  2 lsoave lsoave 4096 2010-08-31 21:50 jruby-1.3.7
drwxr-xr-x  2 lsoave lsoave 4096 2010-08-31 21:50 jruby-1.3.8
drwxr-xr-x  2 lsoave lsoave 4096 2011-05-21 15:44 ree-1.8.7-2010.02
drwxr-xr-x  8 lsoave lsoave 4096 2010-09-08 11:25 ruby-1.8.7-p302
drwxr-xr-x  7 lsoave lsoave 4096 2010-08-29 22:00 ruby-1.8.7-p302@global
drwxr-xr-x  7 lsoave lsoave 4096 2010-08-29 22:24 ruby-1.9.2-head
drwxr-xr-x  7 lsoave lsoave 4096 2010-08-29 22:24 ruby-1.9.2-head@global
drwxr-xr-x  8 lsoave lsoave 4096 2010-08-31 23:47 ruby-1.9.2-p0
drwxr-xr-x  7 lsoave lsoave 4096 2010-08-29 19:50 ruby-1.9.2-p0@global
drwxr-xr-x  8 lsoave lsoave 4096 2011-02-10 19:44 ruby-1.9.2-p136
drwxr-xr-x  7 lsoave lsoave 4096 2011-02-10 19:23 ruby-1.9.2-p136@global
drwxr-xr-x  7 lsoave lsoave 4096 2011-04-08 21:21 ruby-1.9.2-p136@greendog
drwxr-xr-x  7 lsoave lsoave 4096 2011-04-09 00:57 ruby-1.9.2-p136@greendog2
drwxr-xr-x  7 lsoave lsoave 4096 2011-02-15 00:09 ruby-1.9.2-p136@greendog99
drwxr-xr-x  2 lsoave lsoave 4096 2011-02-10 19:04 system
lsoave@ubuntu:~/rails/github/gitwatcher$

is it save to remove all dirs remaining with just "ruby-1.9.2-p136" and "ruby-1.9.2-p136@global" dirs (ruby-1.9.2-p136@greendog* are old and "rvm system" return nothing) ? Will I use "rm" command, or are there RVM embodied commands to cleanup a better way ? Is it possible cleanup the cache dir ?

只用“ruby-1.9.2-p136”和“ruby-1.9.2-p136@global”dirs(ruby-1.9.2-p136@greendog *旧版和“rvm系统”)删除剩余的所有目录没有回报)?我会使用“rm”命令,还是有RVM体现的命令来清理更好的方法?是否可以清理缓存目录?

Thanks in advance. luca

提前致谢。卢卡

2 个解决方案

#1


18  

I suppose rvm cleanup could do the trick.

我想rvm清理可以做到这一点。

Other than that I don't see any reason that deleting the actual gem directories inside RVM if they aren't associated with RVM any more.

除此之外我没有看到任何理由删除RVM中的实际gem目录,如果它们不再与RVM相关联。

If the matching entry doesn't exist in environments then it is safe to delete the accompanying gem dir. As nothing else points to it that RVM would be able to use.

如果环境中不存在匹配的条目,则可以安全地删除附带的gem目录。正如RVM能够使用的其他内容一样。

#2


2  

... it turn out that some of the previous, not used refs, were just gemsets:

...事实证明,之前的一些未使用的引用只是gemsets:

rvm gemset list
lsoave@ubuntu:~$ rvm gemset list

gemsets for ruby-1.9.2-p136 (found in /home/lsoave/.rvm/gems/ruby-1.9.2-p136)
global
greendog
greendog2
greendog99

lsoave@ubuntu:~$

which I removed like following:

我删除了如下:

lsoave@ubuntu:~$ rvm gemset delete greendog99
Are you SURE you wish to remove the entire gemset directory 'greendog99' (/home/lsoave/.rvm/gems/ruby-1.9.2-p136@greendog99)?
(anything other than 'yes' will cancel) > yes
lsoave@ubuntu:~$ rvm gemset delete greendog2
Are you SURE you wish to remove the entire gemset directory 'greendog2' (/home/lsoave/.rvm/gems/ruby-1.9.2-p136@greendog2)?
(anything other than 'yes' will cancel) > yes
lsoave@ubuntu:~$ rvm gemset delete greendog
Are you SURE you wish to remove the entire gemset directory 'greendog' (/home/lsoave/.rvm/gems/ruby-1.9.2-p136@greendog)?
(anything other than 'yes' will cancel) > yes
lsoave@ubuntu:~$

than I made a backup of one of the old 'lib' ( just in case ... ):

我做了一个旧的'lib'备份(以防万一......):

lsoave@ubuntu:~/.rvm/gems$ tar zcvf ruby-1.8.7-p302.gz ./ruby-1.8.7-p302

and removed the relative directory as a previous comment talk, with stuartc:

并删除了相关目录作为之前的评论谈话,与stuartc:

lsoave@ubuntu:~/.rvm/gems$ rm -rf ./ruby-1.8.7-p302

now back to work.

现在回去工作了。

I'll wait a couple of days, looking for everything is right ...

我会等几天,寻找一切都是对的......

#1


18  

I suppose rvm cleanup could do the trick.

我想rvm清理可以做到这一点。

Other than that I don't see any reason that deleting the actual gem directories inside RVM if they aren't associated with RVM any more.

除此之外我没有看到任何理由删除RVM中的实际gem目录,如果它们不再与RVM相关联。

If the matching entry doesn't exist in environments then it is safe to delete the accompanying gem dir. As nothing else points to it that RVM would be able to use.

如果环境中不存在匹配的条目,则可以安全地删除附带的gem目录。正如RVM能够使用的其他内容一样。

#2


2  

... it turn out that some of the previous, not used refs, were just gemsets:

...事实证明,之前的一些未使用的引用只是gemsets:

rvm gemset list
lsoave@ubuntu:~$ rvm gemset list

gemsets for ruby-1.9.2-p136 (found in /home/lsoave/.rvm/gems/ruby-1.9.2-p136)
global
greendog
greendog2
greendog99

lsoave@ubuntu:~$

which I removed like following:

我删除了如下:

lsoave@ubuntu:~$ rvm gemset delete greendog99
Are you SURE you wish to remove the entire gemset directory 'greendog99' (/home/lsoave/.rvm/gems/ruby-1.9.2-p136@greendog99)?
(anything other than 'yes' will cancel) > yes
lsoave@ubuntu:~$ rvm gemset delete greendog2
Are you SURE you wish to remove the entire gemset directory 'greendog2' (/home/lsoave/.rvm/gems/ruby-1.9.2-p136@greendog2)?
(anything other than 'yes' will cancel) > yes
lsoave@ubuntu:~$ rvm gemset delete greendog
Are you SURE you wish to remove the entire gemset directory 'greendog' (/home/lsoave/.rvm/gems/ruby-1.9.2-p136@greendog)?
(anything other than 'yes' will cancel) > yes
lsoave@ubuntu:~$

than I made a backup of one of the old 'lib' ( just in case ... ):

我做了一个旧的'lib'备份(以防万一......):

lsoave@ubuntu:~/.rvm/gems$ tar zcvf ruby-1.8.7-p302.gz ./ruby-1.8.7-p302

and removed the relative directory as a previous comment talk, with stuartc:

并删除了相关目录作为之前的评论谈话,与stuartc:

lsoave@ubuntu:~/.rvm/gems$ rm -rf ./ruby-1.8.7-p302

now back to work.

现在回去工作了。

I'll wait a couple of days, looking for everything is right ...

我会等几天,寻找一切都是对的......