从 UBUNTU 14.0.4 LTS 卸载 Ruby 时出错

error in uninstalling Ruby from UBUNTU 14.0.4 LTS

我在安装 Ruby 时犯了一些错误,现在我正在尝试卸载它 (How to remove ruby from ubuntu),但出现以下错误。我尝试使用 sudo apt-get purge ruby 但仍然无法卸载。它显示 ruby 没有安装,但我确实检查并确认它安装在 /usr/local/bin/ruby 位置。请帮我从我的机器上卸载 Ruby 和 RVM。

$ ruby -v
ruby 1.8.7 (2013-06-27 patchlevel 374) [x86_64-linux]

$ sudo apt-get purge ruby 1.8.7
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Note, selecting 'libhdf5-mpich2-1.8.7' for regex '1.8.7'
Note, selecting 'libhdf5-1.8.7' for regex '1.8.7'
Note, selecting 'libghc-utility-ht-prof-0.0.5.1-87764' for regex '1.8.7'
Note, selecting 'libhdf5-openmpi-1.8.7' for regex '1.8.7'
Note, selecting 'libhdf5-serial-1.8.7' for regex '1.8.7'
Note, selecting 'libghc-utility-ht-dev-0.0.5.1-87764' for regex '1.8.7'
Note, selecting 'libghc-utility-ht-dev' instead of 'libghc-utility-ht-dev-0.0.5.1-87764'
Note, selecting 'libghc-utility-ht-prof' instead of 'libghc-utility-ht-prof-0.0.5.1-87764'
Package 'libhdf5-1.8.7' is not installed, so not removed
Package 'libhdf5-serial-1.8.7' is not installed, so not removed
Package 'libhdf5-mpich2-1.8.7' is not installed, so not removed
Package 'libhdf5-openmpi-1.8.7' is not installed, so not removed
Package 'ruby' is not installed, so not removed
0 upgraded, 0 newly installed, 0 to remove and 567 not upgraded.

如果您想完全删除 ruby,

sudo apt-get purge ruby rubygems

或者您可以按照以下步骤操作,

使用它来找出它是什么

$ readlink -f /usr/local/bin/ruby

/usr/local/bin/ruby1.8.7

使用它来找出正在使用的包:

$ dpkg -S /usr/local/bin/ruby1.8.7
ruby1.8: /usr/local/bin/ruby1.8.7

并使用它来安装,

$ apt-get purge ruby1.8.7

如果您使用的是 rvm,则可以使用命令

卸载 ruby 1.8.7
rvm unistall 1.8.7

然后使用命令

卸载 rvm
rvm implode

我已经从 home 目录中删除了 ruby 目录并按照以下步骤操作...

$ whereis ruby
ruby: /usr/local/bin/ruby /usr/local/lib/ruby

$ ruby -v
ruby 1.8.7 (2013-06-27 patchlevel 374) [x86_64-linux]

$ sudo rm -rf /usr/local/bin/ruby
$ sudo rm -rf /usr/local/lib/ruby
$ ruby -v
bash: /usr/local/bin/ruby: No such file or directory

终于卸载了!! 感谢Rick