How to remove ruby ​​installed by ruby-install

I have many rubies installed by ruby-install in the ~/.rubies :

 ls .rubies ruby-1.9.3-p545 ruby-2.0.0-p598 ruby-2.1.3 ruby-2.1.5 ruby-2.0.0-p451 ruby-2.1.2 ruby-2.1.4 ruby-2.2.0 

I want to remove one of ruby ​​installed by ruby-install. How to do this?

+12
source share
6 answers

Unfortunately, it seems that ruby-install just downloads and compiles Ruby, without the ability to remove it, unlike RVM or rbenv .

So, probably, you will need to execute some manual commands to delete all installed files.

1. Find it

Usually ruby-install installs rubies in the ~/.rubies/ folder.

If you are not sure which ruby ​​was installed using ruby-install , find the .installed.list file, since it contains a list of installed files during Ruby installation. If you want to quickly find it, just run locate.installed.list and you will get a short list of them.

Then run cat for the file located in the version that you want to remove to make sure which root folder to install ruby ​​you want to delete.

2. Delete it

Then you can simply delete the folder where the target version is located.

If you want to remove ruby-1.9.3-p545 , run:

 rm -Rf ~/.rubies/ruby-1.9.3-p545 
+13
source

If you installed the 2.3x (+) package and you need to remove it, there is an executable file for removal in the root directory. Go to C: / and you will see a ruby ​​folder there, inside which will be unin.exe. It all depends on where you decide to install it.

+1
source

You just delete where the ruby ​​is.

For example, remove the ruby ​​that ruby-install has installed (the default installation location is ~/.rubies ):

 rm ~/.rubies/ruby-2.2.0 

If you see this error after uninstalling Ruby 2.2.0-preview2 and installing Ruby 2.2.0-p0, for example:

 $ bundle -v zsh: /Users/Juan/.gem/ruby/2.2.0/bin/bundle: bad interpreter: /Users/Juan/.rubies/ruby-2.2.0-preview2/bin/ruby: no such file or directory 

You need to run

 gem pristin --only-executables 

Since whenever a ruby ​​is updated or can be moved / named, because RubyGems generates an explicit #!/path/to/ruby for all gem executables, it will be necessary to restore the gem bunker's stubs with a new path to ruby ​​executable .

0
source

if you install soft using dpkg or yum when uninstalling it, you should also use dpkg or yum to clean it.

for example, we want unintall fcitx,

sudo apt-get purge -y fcitx

otherwise, manual soft installation, use the configuration && make && make install, just delete the directory installed when it was deleted.

for example. just

rm -rf ~ / .rubies / ruby-2.2.0

if you have doubts that clearly eliminate the target ruby, just use the find command to confirm.

find ~ / -name "ruby-2.2.0"

0
source

I had the same problem with my lubuntu virtual machine! I went into the shell from the login screen (by pressing CNTR + ALT + F3 ) and checked the ruby ​​and gem versions:

ruby -v
gem -v

then I run sudo apt-get purge -y ruby , as suggested by the child. He successfully removed both the ruby ​​and the gem.

Then I rebooted with:

reboot

And again I was able to log in again!

0
source

Based on the responses to the feature request , the best way to uninstall older versions of ruby ​​is to go back to the src directory and run make uninstall or rake uninstall . By default, ruby-install installation uses ruby-install $HOME/src/ruby-$version for unpacked sources of ruby ​​versions during installation.

For example, uninstalling ruby ​​version 2.6.3:

 cd $HOME/src/ruby-2.6.3/ && make uninstall 

Unfortunately, despite the fact that this error / request was opened in 2016, this function is still not implemented in the ruby-install installation.

If you installed ruby ​​using the default locations, then you should be safe by deleting a specific subfolder in $HOME/.rubies/ .

 rm -rf $HOME/.rubies/ruby-2.6.3 

It is worth noting that you may need to manually remove all the gems installed with this version of ruby.

eg

 rm -rf $HOME/.gem/ruby/ruby-2.6.3 
0
source

Source: https://habr.com/ru/post/980197/


All Articles