4

When running this in terminal:

$ curl -L https://get.rvm.io | bash -s

It seems to work fine, but in the Upgrade Notes at the end it says

 * WARNING: You have '~/.profile' file, you might want to load it,
    to do that add the following line to '/Users/steven/.bash_profile':

      source ~/.profile

And I can't use RVM, getting the error

-bash: rvm: command not found'

I am pretty new to terminal and Ruby, so any help would be greatly appreciated.

stevenspiel
  • 5,775
  • 13
  • 60
  • 89

2 Answers2

9

When you install rvm its paths get added to ~/.bash_profile. RVM will warn you about this during installation as you noticed. You could run source ~/.profile each time you load the terminal, but that's a pain in the neck.

From the bash docs:

When bash is invoked as an interactive login shell, or as a non-interactive shell with the --login option, it first reads and executes commands from the file /etc/profile, if that file exists. After reading that file, it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile, in that order, and reads and executes commands from the first one that exists and is readable.

What this means is that /.bash_profile is being run, and /.profile and /.bashrc are being ignored.

To resolve this just open .bash_profile and copy the rvm paths at the top and paste them at the top of your .bashrc file. Open a new terminal window and it should be working just fine. You can either delete .bash_profile, if it's empty, or copy and paste the contents of ~/.profile into it if you choose to keep it.

Mohamad
  • 34,731
  • 32
  • 140
  • 219
  • Awesome, man. Thank you. Like I said, I'm pretty new to terminal, and I'll have to look up how to open and paste paths at the top of other files. Do you have a minute to explain how to do that? – stevenspiel Oct 28 '13 at 14:15
  • 1
    Sure, just use your favourite text editor. Try this: `nano ~/.bash_profile` Don't forget to close and reopen terminal when you make changes. – Mohamad Oct 28 '13 at 14:19
  • 1
    Weird, you sould have `/.bash_profile` since rvm told you so during installation. – Mohamad Oct 28 '13 at 14:20
  • 3
    You want to be looking for this line: `[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM$` once you find it in `/.bash_profile` copy it, then paste it in `/.profile`. – Mohamad Oct 28 '13 at 14:22
  • awesome. I found `[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*` and I copied it. Then I ran `$ nano /.profile` Is that right? – stevenspiel Oct 28 '13 at 14:25
  • 1
    Yes, just paste it in there. Once you are done, just remove `~/.bash_profile` like so: `rm `~/.bash_profile` (if you found and copied that line from there). – Mohamad Oct 28 '13 at 14:32
  • 3 years later, this message still show during installation as a Warning in the upgrade notes. However, I checked `~/.profile`, `~/.bash_profile`, `~/.bashrc` and all these have the the rvm paths added as: `export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting` – Sylvester Loreto Feb 08 '17 at 13:32
1

Do as the instruction said.

From the RVM Troubleshooting page.

If your .bash_profile isn't being correctly loaded on OSX, you need to do one of three things:

Create a file named ~/.bash_profile and add the RVM source line there
Add the RVM source line to ~/.profile
In your terminal preferences, change the shell from the default of /usr/bin/login to /bin/bash.

So, check if you have /Users/steven/.bash_profile in your system. If it is present, open the file and add that line at end of file:

source ~/.profile

else create the file and add it.

kiddorails
  • 12,961
  • 2
  • 32
  • 41