Made a mistake installing RVM with sudo. How to re

2019-04-02 03:02发布

问题:

I am new to Rails and Linux and have installed RVM with sudo.

sudo bash -s stable < <(curl -s https://raw.github/wayneeseguin/rvm/master/binscripts/rvm-installer)

Now I have to run most commands (like spork) with 'rvmsudo'. It is redundant, and the way I learned, when something is redundand it is often wrong. How to get rid of this nuance? Is the only way to reinstall RVM? If so, how to properly reinstall?

回答1:

Use rvm implode to uninstall rvm. Check that there are no environment variables left over in /etc/profile, /etc/bash_profile or whatever shell you're using. Once you do that, then re-install using the single user guide found here.

You'll have to execute the implode command using sudo since you installed it as root.



回答2:

1)remove in home directory:

rm -rf .rvm*

2)remove from your bash file:

[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"

3) remove from /etc/rvmrc file

sudo rm -rf /etc/rvm*

4)Delete everything else

sudo groupdel rvm


回答3:

I couldn't find a complete/concise step-by-step to 100% remove rvm when it was run as root. Here's what I came up with, and I've tested it three times successfully:

sudo su -
rvm implode
groupdel rvm
rm /etc/rvmrc
rm /etc/profile.d/rvm.sh

You'll also want to double check that you don't have ~/.rvm or ~/.rvmrc or any rvm whatnot in your .bashrc (possibly .bash_profile on OSx), as you've likely been trying to install rvm several ways by this point!

Next, you'll need to reboot, as the global environment variables set in /etc/profile.d/rvm.sh will keep getting populated in new shells until you do. After rebooting, open a terminal and try this command to test:

echo $rvm_path

If it's empty, that means you've succeeded! If not, it'll most likely be set to /usr/local/rvm.