如何从系统中删除RVM (Ruby版本管理器)?

时间:2021-09-17 20:02:18

How can I remove RVM (Ruby Version Manager) from my system?

如何从系统中删除RVM (Ruby版本管理器)?

10 个解决方案

#1


832  

There's a simple command built-in that will pull it:

有一个简单的内置命令可以拉它:

rvm implode

This will remove the rvm/ directory and all the rubies built within it. In order to remove the final trace of rvm, you need to remove the rvm gem, too:

这将删除rvm/目录和所有内置的红宝石。为了删除rvm的最终跟踪,您还需要删除rvm gem:

gem uninstall rvm

If you've made modifications to your PATH you might want to pull those, too. Check your .bashrc, .profile and .bash_profile files, among other things.

如果你已经修改了你的路径,你可能也想要把它们拉出来。检查您的.bashrc、.profile和.bash_profile文件以及其他内容。

You may also have an /etc/rvmrc file, or one in your home directory ~/.rvmrc that may need to be removed as well.

您也可以有一个/etc/rvmrc文件,或者在您的主目录~/中。rvmrc也可能需要移除。

#2


47  

If the other answers don’t remove RVM throughly enough for you, RVM’s Troubleshooting page contains this section:

如果其他的答案不能完全删除RVM,那么RVM的故障排除页面包含以下部分:

How do I completely clean out all traces of RVM from my system, including for system wide installs?

Here is a custom script which we name as cleanout-rvm. While you can definitely use rvm implode as a regular user or rvmsudo rvm implode for a system wide install, this script is useful as it steps completely outside of RVM and cleans out RVM without using RVM itself, leaving no traces.

这是一个自定义脚本,我们将其命名为cleanoutrvm。虽然您肯定可以使用rvm内聚作为一个常规用户或rvmsudo rvm内聚来实现系统的广泛安装,但是这个脚本在rvm之外完全可以使用,并且在不使用rvm的情况下清理rvm,不留下任何跟踪。

#!/bin/bash
/usr/bin/sudo rm -rf $HOME/.rvm $HOME/.rvmrc /etc/rvmrc /etc/profile.d/rvm.sh /usr/local/rvm /usr/local/bin/rvm
/usr/bin/sudo /usr/sbin/groupdel rvm
/bin/echo "RVM is removed. Please check all .bashrc|.bash_profile|.profile|.zshrc for RVM source lines and delete
or comment out if this was a Per-User installation."

#3


23  

When using implode and you see:

当使用内爆时,你会看到:

Psychologist intervened, cancelling implosion, crisis avoided :)

Then you may want to use --force

然后你可能会想用——力。

rvm implode --force

Then remove rvm from following locations:

然后从以下位置移除rvm:

rm -rf /usr/local/rvm
sudo rm /etc/profile.d/rvm.sh
sudo rm /etc/rvmrc
sudo rm ~/.rvmrc

Check the following files and remove or comment out references to rvm

检查以下文件并删除或注释掉对rvm的引用。

~/.bashrc 
~/.bash_profile 
~/.profile 
~/.zshrc
~/.zlogin

Comment-out / Remove the following lines from /etc/profile

从/etc/profile中开始/删除以下行。

 source /etc/profile.d/sm.sh
 source /etc/profile.d/rvm.sh

/etc/profile is a readonly file so use

/etc/profile是一个只读文件,因此使用。

sudo vim /etc/profile

And after making the change write using a bang!

在做了修改后,用“砰”的一声!

:w!

Finally re-login / restart your terminal.

最后重新登录/重新启动您的终端。

#4


16  

In addition to @tadman's answer I removed the wrappers in /usr/local/bin as well as the file /etc/profile.d/rvm.

除了@tadman的回答之外,我还删除了/usr/local/bin中的包装器以及文件/etc/profile.d/rvm。

The wrappers include:

包装包括:

erb
gem
irb
rake
rdoc
ri
ruby
testrb

#5


6  

A lot of people do a common mistake of thinking that 'rvm implode' does it . You need to delete all traces of any .rm files . Also , it will take some manual deletions from root . Make sure , it gets deleted and also all the ruby versions u installed using it .

很多人都犯了一个常见的错误,认为“rvm内爆”就是这样。您需要删除任何.rm文件的所有痕迹。此外,它还需要从根中删除一些手动删除。确保,它会被删除,并且所有的ruby版本都使用它。

#6


5  

Remove the RVM load script from /.bash_rc or /.zsh_rc, then use:

从/中删除RVM加载脚本。bash_rc或/。zsh_rc,然后使用:

rm -rf /.rvm

Or:

或者:

rvm implode

#7


2  

Note that if you installed RVM via apt-get, you have to run some further steps than rvm implode or apt-get remove ruby-rvm to get it to really uninstall.

请注意,如果您通过apt-get安装了RVM,那么您必须运行一些比RVM内爆或apt-get删除ruby-rvm的步骤,以使其真正卸载。

See "Installing RVM on Ubuntu".

参见“在Ubuntu上安装RVM”。

#8


1  

Run the following command

运行以下命令

rvm implode

Now you need to unistall the rvm gem:

现在,您需要将rvm gem:

gem uninstall rvm

Check if there are any remaining rvm files in your home directory, if yes remove them.

检查您的主目录中是否有剩余的rvm文件,如果是,删除它们。

Go to the home directory and list all hidden files

转到主目录并列出所有隐藏的文件。

ls -a

ls -

rm  .rvm
rm  .rvmrc

#9


0  

If you're still getting a env: ruby_executable_hooks: No such file or directory when calling some Ruby package, that means RVM left a little gift for you in your $PATH.

如果您仍然得到一个env: ruby_executable_hook:在调用某个Ruby包时没有这样的文件或目录,这意味着RVM在您的$PATH中为您留了一个小礼物。

Run the following to find the offending scripts:

运行以下命令查找违规脚本:

grep '#!/usr/bin/env ruby_executable_hooks' /usr/local/bin/*

Then rm all the matches. You'll have to reinstall all of those libraries with an RVM-free gem, of course.

然后把所有的火柴都放进去。当然,你将不得不重新安装所有这些库,并使用无rvm的gem。

#10


0  

For other shell newbies trying to fix the PATH variable

其他shell newbies尝试修复PATH变量。

After following instructions in accepted answer, check and modify your PATH variable if necessary :

在接受回答后,如有必要,检查并修改您的路径变量:

env | grep PATH 

if you see "rvm" anywhere, you need to figure out where you are setting PATH and modify. I was setting it in 3 files - so check all the following files:

如果您在任何地方都看到了“rvm”,那么您需要确定您所设置的路径和修改的位置。我把它设置成3个文件-所以检查所有的文件:

vim .bashrc  

Delete the lines in the file referencing rvm using the dd command. :wq to save and exit.
source .bashrc to "reload"

使用dd命令删除引用rvm的文件中的行。:wq保存和退出。源. bashrc“重新加载”

Repeat this process (starting with the vim command) for .profile and .bash_profile

对.profile和.bash_profile重复此过程(从vim命令开始)。

#1


832  

There's a simple command built-in that will pull it:

有一个简单的内置命令可以拉它:

rvm implode

This will remove the rvm/ directory and all the rubies built within it. In order to remove the final trace of rvm, you need to remove the rvm gem, too:

这将删除rvm/目录和所有内置的红宝石。为了删除rvm的最终跟踪,您还需要删除rvm gem:

gem uninstall rvm

If you've made modifications to your PATH you might want to pull those, too. Check your .bashrc, .profile and .bash_profile files, among other things.

如果你已经修改了你的路径,你可能也想要把它们拉出来。检查您的.bashrc、.profile和.bash_profile文件以及其他内容。

You may also have an /etc/rvmrc file, or one in your home directory ~/.rvmrc that may need to be removed as well.

您也可以有一个/etc/rvmrc文件,或者在您的主目录~/中。rvmrc也可能需要移除。

#2


47  

If the other answers don’t remove RVM throughly enough for you, RVM’s Troubleshooting page contains this section:

如果其他的答案不能完全删除RVM,那么RVM的故障排除页面包含以下部分:

How do I completely clean out all traces of RVM from my system, including for system wide installs?

Here is a custom script which we name as cleanout-rvm. While you can definitely use rvm implode as a regular user or rvmsudo rvm implode for a system wide install, this script is useful as it steps completely outside of RVM and cleans out RVM without using RVM itself, leaving no traces.

这是一个自定义脚本,我们将其命名为cleanoutrvm。虽然您肯定可以使用rvm内聚作为一个常规用户或rvmsudo rvm内聚来实现系统的广泛安装,但是这个脚本在rvm之外完全可以使用,并且在不使用rvm的情况下清理rvm,不留下任何跟踪。

#!/bin/bash
/usr/bin/sudo rm -rf $HOME/.rvm $HOME/.rvmrc /etc/rvmrc /etc/profile.d/rvm.sh /usr/local/rvm /usr/local/bin/rvm
/usr/bin/sudo /usr/sbin/groupdel rvm
/bin/echo "RVM is removed. Please check all .bashrc|.bash_profile|.profile|.zshrc for RVM source lines and delete
or comment out if this was a Per-User installation."

#3


23  

When using implode and you see:

当使用内爆时,你会看到:

Psychologist intervened, cancelling implosion, crisis avoided :)

Then you may want to use --force

然后你可能会想用——力。

rvm implode --force

Then remove rvm from following locations:

然后从以下位置移除rvm:

rm -rf /usr/local/rvm
sudo rm /etc/profile.d/rvm.sh
sudo rm /etc/rvmrc
sudo rm ~/.rvmrc

Check the following files and remove or comment out references to rvm

检查以下文件并删除或注释掉对rvm的引用。

~/.bashrc 
~/.bash_profile 
~/.profile 
~/.zshrc
~/.zlogin

Comment-out / Remove the following lines from /etc/profile

从/etc/profile中开始/删除以下行。

 source /etc/profile.d/sm.sh
 source /etc/profile.d/rvm.sh

/etc/profile is a readonly file so use

/etc/profile是一个只读文件,因此使用。

sudo vim /etc/profile

And after making the change write using a bang!

在做了修改后,用“砰”的一声!

:w!

Finally re-login / restart your terminal.

最后重新登录/重新启动您的终端。

#4


16  

In addition to @tadman's answer I removed the wrappers in /usr/local/bin as well as the file /etc/profile.d/rvm.

除了@tadman的回答之外,我还删除了/usr/local/bin中的包装器以及文件/etc/profile.d/rvm。

The wrappers include:

包装包括:

erb
gem
irb
rake
rdoc
ri
ruby
testrb

#5


6  

A lot of people do a common mistake of thinking that 'rvm implode' does it . You need to delete all traces of any .rm files . Also , it will take some manual deletions from root . Make sure , it gets deleted and also all the ruby versions u installed using it .

很多人都犯了一个常见的错误,认为“rvm内爆”就是这样。您需要删除任何.rm文件的所有痕迹。此外,它还需要从根中删除一些手动删除。确保,它会被删除,并且所有的ruby版本都使用它。

#6


5  

Remove the RVM load script from /.bash_rc or /.zsh_rc, then use:

从/中删除RVM加载脚本。bash_rc或/。zsh_rc,然后使用:

rm -rf /.rvm

Or:

或者:

rvm implode

#7


2  

Note that if you installed RVM via apt-get, you have to run some further steps than rvm implode or apt-get remove ruby-rvm to get it to really uninstall.

请注意,如果您通过apt-get安装了RVM,那么您必须运行一些比RVM内爆或apt-get删除ruby-rvm的步骤,以使其真正卸载。

See "Installing RVM on Ubuntu".

参见“在Ubuntu上安装RVM”。

#8


1  

Run the following command

运行以下命令

rvm implode

Now you need to unistall the rvm gem:

现在,您需要将rvm gem:

gem uninstall rvm

Check if there are any remaining rvm files in your home directory, if yes remove them.

检查您的主目录中是否有剩余的rvm文件,如果是,删除它们。

Go to the home directory and list all hidden files

转到主目录并列出所有隐藏的文件。

ls -a

ls -

rm  .rvm
rm  .rvmrc

#9


0  

If you're still getting a env: ruby_executable_hooks: No such file or directory when calling some Ruby package, that means RVM left a little gift for you in your $PATH.

如果您仍然得到一个env: ruby_executable_hook:在调用某个Ruby包时没有这样的文件或目录,这意味着RVM在您的$PATH中为您留了一个小礼物。

Run the following to find the offending scripts:

运行以下命令查找违规脚本:

grep '#!/usr/bin/env ruby_executable_hooks' /usr/local/bin/*

Then rm all the matches. You'll have to reinstall all of those libraries with an RVM-free gem, of course.

然后把所有的火柴都放进去。当然,你将不得不重新安装所有这些库,并使用无rvm的gem。

#10


0  

For other shell newbies trying to fix the PATH variable

其他shell newbies尝试修复PATH变量。

After following instructions in accepted answer, check and modify your PATH variable if necessary :

在接受回答后,如有必要,检查并修改您的路径变量:

env | grep PATH 

if you see "rvm" anywhere, you need to figure out where you are setting PATH and modify. I was setting it in 3 files - so check all the following files:

如果您在任何地方都看到了“rvm”,那么您需要确定您所设置的路径和修改的位置。我把它设置成3个文件-所以检查所有的文件:

vim .bashrc  

Delete the lines in the file referencing rvm using the dd command. :wq to save and exit.
source .bashrc to "reload"

使用dd命令删除引用rvm的文件中的行。:wq保存和退出。源. bashrc“重新加载”

Repeat this process (starting with the vim command) for .profile and .bash_profile

对.profile和.bash_profile重复此过程(从vim命令开始)。