1

I am following this guide to removing rvm and was wondering what I should remove within my .bashrc, .profile and .bash_profile files. I manually removed /.rvm and cannot find .profile. These are the paths that I have in .bashrc and .bash_profile:

.bashrc

PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting

### Added by the Heroku Toolbelt
export PATH="/usr/local/heroku/bin:$PATH"

Do I need to remove anything? Maybe the first line?

.bash_profile

export PATH=/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:/Users/user/.rvm/gems/ruby-2.1.1/bin:/Users/user/.rvm/gems/ruby-2.1.1@global/bin:/Users/user/.rvm/rubies/ruby-2.1.1/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Users/user/.rvm/bin:/Users/connorphillips/mongodb/bin

Should I remove all of this?

Community
  • 1
  • 1
cphill
  • 4,286
  • 10
  • 62
  • 137

1 Answers1

0

Delete the .bashrc entire line:

PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting

Edit the .bash_profile line to remove only the RVM paths, so your line becomes:

export PATH=/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Users/connorphillips/mongodb/bin

Your particular system may not have a .profile file and that's fine.

Here's my script to remove RVM for the entire system, for all users.

https://github.com/SixArm/sixarm_unix_shell_scripts/blob/master/rvm-uninstall-danger

#!/bin/bash
#
# Uninstall RVM (Ruby Version Manager). THIS IS DANGEROUS.
#
# This runs rvm implode, delete RVM files from the system,
# deletes /home/*/.rvmrc files and /home/*/.rvm directories,
# and uninstalls all RVM gems. We run this script as root.
#
# Adjust as you like for your needs. 
#
# Some of the script lines may report missing directories.
# For example, a Mac system typically has a /Users/ directory,
# whereas a Linux system typically has a /home/ directory.
# You can delete the lines that you don't need, if you like.
#
# If rvm implode gives errors like this loop:
#
#    line 72: /usr/local/rvm/scripts/rvm: No such file or directory
#
# then the rvm setup is bonked and we can delete the rvm script
# by hand then run this script again; rvm implode won't work,
# but the rest of the script will do a decent job of deleting
# any lingering rvm files and reporting any remainders.
#
# Author: Joel Parker Henderson (joel@joelparkerhenderson.com)
# License: GPL
#
set -o nounset
set -o errexit
set -o pipefail

echo "rvm implode"
rvm implode

echo "remove rvm files from system-wide areas"
sudo rm -rf /usr/local/bin/rvm
sudo rm -rf /usr/local/rvm
sudo rm -rf /etc/rvmrc
sudo rm -rf /etc/profile.d/rvm.sh

echo "remove rvm files from all likely user areas"
sudo rm -rf /home/*/.rvmrc
sudo rm -rf /home/*/.rvm
sudo rm -rf /Users/*/.rvmrc
sudo rm -rf /Users/*/.rvm

echo "remove rvm files from the current user's home"
sudo rm -rf $HOME/.rvmrc
sudo rm -rf $HOME/.rvm

echo "uninstall rvm gem"
gem uninstall -a -q rvm

echo "delete rvm group"
sudo /usr/sbin/groupdel rvm

echo "try to find any remaining .rvmrc files to delete by hand"
find -L / -name .rvmrc

echo "try to find rvm text in configuration files to edit by hand"
find -L / -type f | grep "\(bash_login\|bash_profile\|bashrc\|profile\|zshenv\|zshrc\|zlogin\|zlogout\|zprofile\)$" | xargs -I{} grep -Iil "rvm" {}
joelparkerhenderson
  • 32,633
  • 18
  • 90
  • 113
  • Hey @joelparkerhenderson thank you for your help. How should I run your script from the command line? Add all of this information to a file and then try to run it in terminal? Thanks again! – cphill Aug 23 '14 at 13:33
  • Also Would `.bash_login` also be a file of interest? There is reference to .rvm in that file. ` [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function* export PATH="/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:$PATH" ` – cphill Aug 23 '14 at 13:40
  • Yes, you can save that whole script as a file then run it. Or, you can simply copy/paste any line on your terminal because each line is independent. Yes, do bash_login as well; I will add that to the script on GitHub. – joelparkerhenderson Aug 23 '14 at 23:24