rvm installation not working: "RVM is not a function"
I just installed RVM, but can't make it work. I have such line at the end of my .profile
file:
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"
I tried to run source .profile
and restarting terminal, but still, when I run rvm use 1.9.2
I'm getting:
RVM is not a function, selecting rubies with 'rvm use ...' will not work.
My system is Ubuntu 11.10.
Solution 1:
You need to run the following
$ source ~/.rvm/scripts/rvm
then run this
$ type rvm | head -n 1
and if you get
rvm is a function
the problem is solved.
You also need to run user$ rvm requirements
to see dependency requirements for your operating system
Source: https://rvm.io/rvm/install/
I forget mention that you need to put this code into you ~/.bashrc or ~/.zshrc file and you will not need to write this code again. Cheers!
Solution 2:
You are not using an login shell.
The process of enabling the login flag is described here, also some details on what a login shell is can be found here.
Thus, you need to check the option "Run as login shell" in the Gnome terminal's settings. It is required to open new terminal after this setting the flag.
Sometimes it is required to set the command to /bin/bash --login
.
For remote connections it is important to understand the differene between running interactive ssh
session and executing single commands.
While running ssh server
and then working with the server interactively you are using login shell by default and it's all fine, but for ssh server "command"
you are not using login shell and it would be required to run it with ssh server 'bash -lc "command"'
.
Any remote invocation can have the same problem as executing single command with ssh
.
Solution 3:
To permanently resolve this just cut/paste following line:
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
From: ~/.bash_profile
file
To: ~/.bashrc
file
Reason this works is that .bashrc
is executed each time you enter terminal, and .bash_profile
each time you login. That is why solution /bin/bash --login
works, but you have to do that each time you enter terminal. This way you are set until your next format, and you will forget all this by then :)
Solution 4:
I too faced this problem. Finally i executed this line on terminal.
source ~/.rvm/scripts/rvm
Problem is fixed. Because this line will make the RVM instance a function for a particular time.
Solution 5:
The latest RVM (rvm 1.11.6 (stable)) stopped working on Ubuntu (10.10 - 64 bit - nerdy gnat or whatever) - I kept getting
"RVM is not a function, selecting rubies with 'rvm use ...' will not work."
Before, I got the message, but 'rvm 1.9.3-p0@rails321' would work. Now, it wouldn't work - you couldn't change gemsets at all.
Nothing worked, until I found this - make this the LAST line in /home/your-name/.bashrc
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"