108

Really, I don't know what happened. Excuse me if this question is so NOOB, but I can't find the solution for this problem.

-bash: rvm: command not found

I tried this

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

but still nothing I need to see the ruby version for use the simplecov because it not works with older version from 1.9

Community
  • 1
  • 1
Asantoya17
  • 4,465
  • 6
  • 23
  • 29

10 Answers10

260

It might because the terminal not having rvm shell configuration loaded.

Try following from your terminal:

$ source ~/.rvm/scripts/rvm

then

$ type rvm | head -n 1

If the output is:

rvm is a function

You may need to add "source ~/.rvm/scripts/rvm" to your ~/.bash_profile file

peterpengnz
  • 5,897
  • 2
  • 21
  • 18
  • 2
    Thanks! It worked for me too. What is the reason for this? Did I miss a step when installing rvm? – Bruno Feb 08 '13 at 09:43
  • 16
    @Bruno I came to this page too, then realised it actually says in the install message: To start using RVM you need to run `source /Users/username/.rvm/scripts/rvm` – jamie-wilson Sep 12 '13 at 21:34
  • doesn't work. First command returns "no such file or directory" other ones - rvm not found – Vyachaslav Gerchicov Mar 17 '16 at 08:05
  • @peterpengnz it worked on my mac even without the second command i.e i didn't need to write it down in the bash_profile – Sumit Kumar Saha Jul 18 '16 at 10:34
  • @VyachaslavGerchicov I had the same problem, I guess you are running with sudo, if you don't it will work – layser Jul 23 '16 at 10:09
  • Shoudn't we specify here that the last step should be adding `~/.bash_profile file` to the Path in `~/.bash_profile` (make the instructions a bit more explicit) ? – Timotheus.Kampik Jan 15 '17 at 10:54
  • This is not a complete answer, see mine: https://stackoverflow.com/a/48914964/1223975 – Alexander Mills Feb 21 '18 at 20:33
  • Hi, I try you solution by typing ```source ~/.rvm/scripts/rvm``` in terminal, but I get ```/Users/mine/.rvm/scripts/rvm:12: command not found: uname /Users/mine/.rvm/scripts/rvm:29: command not found: ps ``` is there a way to solve it? – wahyu Feb 01 '21 at 02:10
  • How to add "source ~/.rvm/scripts/rvm" to your ~/.bash_profile file? – Pablo Jan 31 '23 at 10:03
55

you need to read all the texts that are displayed when you install RVM:

rm -rf ~/.rvm
curl -L https://get.rvm.io | bash -s stable
mpapis
  • 52,729
  • 14
  • 121
  • 158
  • Thanks a lot @mpapis i was trying to install rvm for past couple of hours but cound not figure out why rvm command not found was coming. The first line did the trick. Thanks again – Sumit Kumar Saha Jul 18 '16 at 10:29
  • No go. LOTS of error messages. This reminds me of the bad old days of Linux. – Tony Nov 06 '18 at 16:38
  • And how do you do this? "You may need to add "source ~/.rvm/scripts/rvm" to your ~/.bash_profile file". – MadMac Apr 21 '22 at 02:40
52

after you run sudo curl -L https://get.rvm.io | bash -s stable --ruby

you need to close the terminal ,then open again!

Adrian
  • 16,233
  • 18
  • 112
  • 180
parkerqian
  • 621
  • 5
  • 2
9

This worked for me:

rm -rf ~/.rvm
curl -L https://get.rvm.io | bash -s stable
bsiamionau
  • 8,099
  • 4
  • 46
  • 73
DonRichards
  • 136
  • 1
  • 4
5

source /etc/profile worked for me.

Wilson Silva
  • 10,046
  • 6
  • 26
  • 31
5

For a long-term solution, you should add this to your ~/.profile file:

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

to simply load rvm into a single terminal, use

source "$HOME/.rvm/scripts/rvm"

supposedly this call is more cross-platform:

. "$HOME/.rvm/scripts/rvm"
Alexander Mills
  • 90,741
  • 139
  • 482
  • 817
4

As suggested by @mpapis, Do this first

$ rm -rf ~/.rvm

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

Then, as suggested by @peterpengnz, do this and you should be fine with RVM cmd issues

$ source ~/.rvm/scripts/rvm

k9x
  • 81
  • 5
  • Can you provide any limitations, assumptions or simplifications in your answer. See more details on how to answer at this link: https://stackoverflow.com/help/how-to-answer – Usama Abdulrehman Jun 14 '20 at 04:01
2

Close and restart terminal after installing RVM — gets me EVERY TIME.

1

To start using RVM, you'll need to enter source /Users/yourusername/.rvm/scripts/rvm into your terminal (of course, insert your real username in place of yourusername).

CodeBiker
  • 2,985
  • 2
  • 33
  • 36
0

Close and reopen your terminal. Sometimes, the changes made during the installation of rvm are not immediately picked up by your terminal, so reopening it should resolve the problem.