2017-11-10 255 views
0

我最近安装了Ruby版本管理器(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."` 

(我发现这个剧本here我也尝试过更胆小方法如rvm imploderm -rf ~/.rvm等)

现在

$ which rvm

个回报什么,但RVM似乎仍然存在以某种形式,因为当我输入

$ rvm implode

我得到的反应,具体为:

cat: /Users/lolan/.rvm/VERSION: No such file or directory Warning! PATH is not properly set up, '/Users/lolan/.rvm/gems/ruby-2.3.1/bin' is not available. Usually this is caused by shell initialization files. Search for 'PATH=...' entries. You can also re-add RVM to your profile by running: 'rvm get stable --auto-dotfiles'. To fix it temporarily in this shell session run: 'rvm use ruby-2.3.1'. To ignore this error add rvm_silence_path_mismatch_check_flag=1 to your ~/.rvmrc file. -bash: /Users/lolan/.rvm/scripts/base: No such file or directory -bash: /Users/lolan/.rvm/scripts/functions/implode: No such file or directory Are you SURE you wish for rvm to implode? This will recursively remove /Users/lolan/.rvm and other rvm traces? (anything other than 'yes' will cancel) > Psychologist intervened, cancelling implosion, crisis avoided :)

(这时候我输入的回报当它提示我'是'时。其他时间,我输入'是'。)

基本上,我很迷惑$ which rvm如何返回什么,但$ rvm implode不返回“找不到命令”。这与我认为我对命令行的理解是相反的......

无论如何,我怎么才能真的杀死RVM,连同它的心理学家和所有? :)

PS:我在macOS 10.12上。

==============

更新:看来,尽管已通过所有标准步骤后去除RVM(见上文),尽管刷新壳(点菜source .bash_profile,source .bashrc,source .profile),外壳仍然留着一些内存,不知何故,RVM,当我开始一个全新的外壳时就消失了。

我仍然想更好地理解shell是如何保持周围的,因为保留脚本文件夹的各个部分(在删除脚本文件夹之后!?!?)对我来说似乎是危险的,违反直觉的。

回答

0

这是因为rvm位于您的主目录的隐藏目录中,而不是您的PATHwhich使用与bash相同的算法在环境变量PATH中列出的目录中搜索可执行文件或脚本。如果它没有找到它,那么它将不会被退回。如果你想知道如何删除RVM there is already an answer for that。最简单的方法是:rm -rf ~/.rvm

+0

正如我的问题所述,我已经做了'rm -rf〜/ .rvm'。您指出的链接也已经在我的问题中引用。无论如何,我只是再次检查一下'rm〜/ .rvm'不会改变结果。下次请仔细阅读该问题。 – Labrador

+0

顺便说一句,如果'〜/ .abc'是一个隐藏文件夹,在命令行输入'abc xyz'会发送shell在〜/ .abc目录下寻找脚本“xyz”somwhere?即使〜/ .rvm文件夹仍然存在(它不是),我不明白“rvm”将被视为可执行命令的机制......你能解释一下吗? – Labrador

+1

检查[二进制与功能模式](https://rvm.io/workflow/scripting)。rvm作为shell函数加载。 – anothermh