How to remove RVM (Ruby Version Manager) from my system

RubyRubygemsRvm

Ruby Problem Overview


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

Ruby Solutions


Solution 1 - Ruby

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, if you installed that:

gem uninstall rvm

There may be elements left over from a Homebrew, Apt or DNF install of it that require removal as well. This depends on how you installed it in the first place. That clean-up step is optional, as RVM will no longer be involved in Ruby, but can help keep things organized.

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.

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

Solution 2 - Ruby

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

> ## 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. > > > > #!/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."

Solution 3 - Ruby

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 the following locations:

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:

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

Comment-out/remove the following lines from /etc/profile:

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

/etc/profile is a read-only file so use:

sudo vim /etc/profile

And after making the change write using a bang!

:w!


                                

Finally re-login/restart your terminal.

Solution 4 - Ruby

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

The wrappers include:

erb
gem
irb
rake
rdoc
ri
ruby
testrb

Solution 5 - Ruby

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 .

Solution 6 - Ruby

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

rm -rf /.rvm

Or:

rvm implode

Solution 7 - Ruby

Run:

rvm implode

Now you need to uninstall the RVM gem using:

gem uninstall rvm

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

Go to the home directory and list all hidden files:

ls -a

rm  .rvm
rm  .rvmrc

Solution 8 - Ruby

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.

See "https://stackoverflow.com/questions/8402827/installing-rvm-on-ubuntu";.

Solution 9 - Ruby

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.

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.

Solution 10 - Ruby

For other shell newbies trying to fix the PATH variable

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:

vim .bashrc  

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

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

Solution 11 - Ruby

I am running Ubuntu 19.04 and followed all the instructions above and then some. Finally, what worked for me was to run

sudo apt autoremove rvm

and now when I try and reinstall RVM it's actually gone. RVM is invasive, to say the least.

Solution 12 - Ruby

Per RVM's troubleshooting documentation "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. > > #!/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."

Solution 13 - Ruby

Complementing @Kingsley Ijomah answer...

It may be necessary to fix the PATH so that the rvm command also disappears from the terminal.

To check your PATH:

env | grep PATH

To fix your PATH removing RVM directories:

dir_to_remove=/home/user/.rvm/bin
PATH=:$PATH:
PATH=${PATH//:$dir_to_remove:/:}
PATH=${PATH#:}; PATH=${PATH%:}

In this case, if you have more than one directory, change dir_to_remove one at a time.

I needed to remove some rvm and rbenv directories as I am now using asdf.

Be careful.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionlucianosousaView Question on Stackoverflow
Solution 1 - RubytadmanView Answer on Stackoverflow
Solution 2 - RubyRory O'KaneView Answer on Stackoverflow
Solution 3 - RubyKingsley IjomahView Answer on Stackoverflow
Solution 4 - RubyhinosxView Answer on Stackoverflow
Solution 5 - RubyCaffeine CoderView Answer on Stackoverflow
Solution 6 - RubyVishnu AtraiView Answer on Stackoverflow
Solution 7 - RubyslalView Answer on Stackoverflow
Solution 8 - RubyrogerdpackView Answer on Stackoverflow
Solution 9 - RubychbrownView Answer on Stackoverflow
Solution 10 - RubyleenyburgerView Answer on Stackoverflow
Solution 11 - RubyabadfishView Answer on Stackoverflow
Solution 12 - Rubythe Tin ManView Answer on Stackoverflow
Solution 13 - RubythiagoBarbosa48View Answer on Stackoverflow