如何从 Ubuntu 中删除 Ruby
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/22753785/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to remove Ruby from Ubuntu
提问by Harman
I want to remove Ruby, so I try this. How can I remove this?
我想删除 Ruby,所以我试试这个。我怎样才能删除它?
sudo apt-get autoremove ruby
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package 'ruby' is not installed, so not removed
0 upgraded, 0 newly installed, 0 to remove and 534 not upgraded.
here@jaskaran:/$ whereis ruby
ruby: /usr/bin/ruby /usr/lib/ruby /usr/bin/X11/ruby /usr/share/man/man1/ruby.1.gz
here@jaskaran:/$ ruby -v
ruby 1.9.3p194 (2012-04-20 revision 35410) [i686-linux]
回答by Amadan
Ubuntu...?
乌班图……?
Use this to find out what executable you're running:
使用它来找出您正在运行的可执行文件:
$ which ruby
/usr/bin/ruby
Use this to find out what it actually is:
使用它来找出它的实际情况:
$ readlink -f /usr/bin/ruby
/usr/bin/ruby1.8
Use this to find out what package it belongs to:
使用它来找出它属于哪个包:
$ dpkg -S /usr/bin/ruby1.8
ruby1.8: /usr/bin/ruby1.8
Use this to uninstall that:
使用它来卸载那个:
$ apt-get purge ruby1.8
Note: If you have installed Ruby using Version/Environment managers like RVMor Rbenvthen this method is not gonna work because Rubies will be installed as scripts not packages.
注意:如果您已经使用RVM或Rbenv等版本/环境管理器安装了 Ruby,那么此方法将不起作用,因为Ruby将作为脚本而不是包安装。
回答by Aboozar Rajabi
If you used rbenvto install it, you can use
如果你曾经rbenv安装过它,你可以使用
rbenv versions
to see which versions you have installed.
查看您安装了哪些版本。
Then, use the uninstall command:
然后,使用卸载命令:
rbenv uninstall [-f|--force] <version>
for example:
例如:
rbenv uninstall 2.4.0 # Uninstall Ruby 2.4.0
回答by Mukesh Chapagain
If you have installed Ruby using RVM then the following command will completely remove RVM installed directory:
如果您已经使用 RVM 安装了 Ruby,那么以下命令将完全删除 RVM 安装目录:
rvm implode
rvm implode
Running this command will ask for your confirmation to delete the .rvmdirectory.
运行此命令将要求您确认删除.rvm目录。
After it completes deleting the .rvmdirectory, you get the following message which is worth notable:
完成删除.rvm目录后,您会收到以下值得注意的消息:
Note you may need to manually remove /etc/rvmrc and ~/.rvmrc if they exist still.
Please check all .bashrc .bash_profile .profile and .zshrc for RVM source lines and delete or comment out if this was a Per-User installation.
请注意,如果 /etc/rvmrc 和 ~/.rvmrc 仍然存在,您可能需要手动删除它们。
请检查所有 .bashrc .bash_profile .profile 和 .zshrc 以获取 RVM 源代码行,如果这是每用户安装,请删除或注释掉。
回答by Bharat soni
At first find out where ruby is? then
首先找出ruby在哪里?然后
rm -rf /usr/local/lib/ruby
rm -rf /usr/lib/ruby
rm -f /usr/local/bin/ruby
rm -f /usr/bin/ruby
rm -f /usr/local/bin/irb
rm -f /usr/bin/irb
rm -f /usr/local/bin/gem
rm -f /usr/bin/gem
Or you can try this one also.
或者你也可以试试这个。
aptitude purge ruby

