Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

rvm installation not working: "RVM is not a function"

Tags:

ruby

rvm

People also ask

Is not a function selecting rubies with RVM use will not work?

RVM is not a function, selecting rubies with 'rvm use ...' will not work. You need to change your terminal emulator preferences to allow login shell. Sometimes it is required to use `/bin/bash --login` as the command. Please visit https://rvm.io/integration/gnome-terminal/ for an example.

What are the functions of RVM?

rvm can only be used for regression at the moment. the kernel function used in training and predicting. This parameter can be set to any function, of class kernel, which computes a dot product between two vector arguments.


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!


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.


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 :)


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.


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"


As you said, the error shown could be the following one.

RVM is not a function, selecting rubies with 'rvm use ...' will not work.

You need to change your terminal emulator preferences to allow login shell.
Sometimes it is required to use `/bin/bash --login` as the command. 
Please visit https://rvm.io/integration/gnome-terminal/ for a example.

As said above, just type '/bin/bash --login' in your terminal (after restarting your terminal), then type the comand 'rvm use 1.9.3' (for e.g.) and it will start using the same version.

Just execute the command 'ruby -v' to confirm that the RVM is using the updated version of Ruby.