594

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

the Tin Man
  • 150,910
  • 39
  • 198
  • 279
lucianosousa
  • 7,548
  • 4
  • 17
  • 25
  • 10
    Not sure about your intentions to remove `rvm` -- it could be its 'obtrusiveness' -- but [`rbenv`](https://github.com/sstephenson/rbenv) is a a worthwhile alternative.You can still manage multiple Ruby versions on your system, but it doesn't override shell commands, doesn't manage gemsets (Bundler is more than sufficient), and doesn't need to be loaded in the shell. – Jochem Schulenklopper Oct 20 '12 at 19:36

12 Answers12

955

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:

gem uninstall rvm

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.

tadman
  • 194,930
  • 21
  • 217
  • 240
  • 22
    +1 for noting the profile settings and the gem uninstall, _if_ you didn't listen to Wayne in the first place and installed it as a gem. :) – Jed Schneider Aug 24 '10 at 16:57
  • 3
    It installs just fine as a gem if you remember to update it afterwards. I find that a more reliable method than source installing anything. Wayne also says to not root install it but I don't listen to him on that point either. It's so much better to have an rvm-managed system Ruby. 1.9.2p0 is working perfectly with both TextMate, shell and Passenger. – tadman Aug 24 '10 at 17:04
  • 7
    If you -like me- have rvm configured in passenger, make sure to reinstall passenger afterwards too. – berkes Apr 06 '11 at 09:41
  • Uninstalling like this breaks the path to the default ruby. – Moshe Jul 06 '11 at 19:17
  • 4
    It may break it temporarily until you create a new shell, as that's just how things like `bash` behave when you yank executables out of the `PATH`. – tadman Jul 06 '11 at 20:58
  • 16
    I also had a reference to RVM in `~/.zshrc` – Nate Cook Jun 15 '13 at 13:19
  • 1
    Hi, if you continue to receive permission denied error after you followed the above instructions, make sure you logout and relogin as a single user. It worked for me – Nick_K Feb 03 '14 at 07:40
  • After performing these steps (in order to switch to rbenv), my environment was still littered with variables left over from RVM, even after purging its files from my Ubuntu system and restarting my terminals. I rebooted, and they were all gone. I rebooted so I could be sure there wasn't some init file somewhere setting them again. – hourback Feb 18 '14 at 21:03
  • 1
    I needed to type ```rvm implode --force``` without the force option I could not implode. – Thomas Jun 28 '14 at 15:38
  • 2
    I also had a reference to RVM in ~/.zlogin – Sano J Feb 02 '15 at 16:08
  • 10
    Anyone else feel like uninstalling rvm should be easier than this? Good gravy. – mycargus May 14 '15 at 06:24
  • I had to remove also `source /usr/local/rvm/scripts/cli` from the `.bashrc`. – Tibor Nagy Jun 08 '15 at 09:44
60

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."
Rory O'Kane
  • 25,436
  • 11
  • 86
  • 123
44

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.

the Tin Man
  • 150,910
  • 39
  • 198
  • 279
Kingsley Ijomah
  • 2,995
  • 27
  • 25
  • What makes that initial message appear? – Newbyte Mar 06 '20 at 17:44
  • 1
    If RVM was installed for a single user, it shouldn't have been done using `sudo` initially, so none of its files will be in the `/etc` or `/usr` paths. Only when it was installed using the multi-user or with `sudo` will you see that, and their existence are strong hints that the [RVM installation documentation](https://rvm.io/rvm/install) was _NOT_ followed to install it in the first place. – the Tin Man Apr 13 '20 at 23:52
17

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
MrYoshiji
  • 51,182
  • 12
  • 115
  • 106
hinosx
  • 181
  • 1
  • 2
7

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 .

Caffeine Coder
  • 1,729
  • 1
  • 15
  • 34
6

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

rm -rf /.rvm

Or:

rvm implode
the Tin Man
  • 150,910
  • 39
  • 198
  • 279
Vishnu Atrai
  • 2,175
  • 18
  • 22
5

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
the Tin Man
  • 150,910
  • 39
  • 198
  • 279
slal
  • 2,063
  • 16
  • 25
3

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 "Installing RVM on Ubuntu".

Community
  • 1
  • 1
rogerdpack
  • 50,731
  • 31
  • 212
  • 332
2

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.

chbrown
  • 10,408
  • 2
  • 47
  • 57
2

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

leenyburger
  • 1,108
  • 1
  • 11
  • 21
0

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.

the Tin Man
  • 150,910
  • 39
  • 198
  • 279
abadfish
  • 11
  • 4
  • There are numerous attempts to explain how to install RVM across the internet, and most are very out-of-date and quite wrong because the application has grown a lot in the years since it was released. [RVM's site](https://rvm.io/) is the definitive source for information about installing, deleting, or using it. There are many pages because it's flexible tool, but if you follow the basic installation you'll find it's not at all invasive and quite easy to manage or remove. – the Tin Man Apr 14 '20 at 00:13
0

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."
the Tin Man
  • 150,910
  • 39
  • 198
  • 279