rvm installation not working: “RVM is not a functi

2019-01-01 09:41发布

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.

标签: ruby rvm
20条回答
无与为乐者.
2楼-- · 2019-01-01 10:14

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!

查看更多
与君花间醉酒
3楼-- · 2019-01-01 10:14

Open Up the Terminal and then Go to Edit > Profile Preferences and then go to the Tab "Title and Command" and Check "Run Command as Login Shell".

Boot Up a Bash and Now you can install Gems directly from the terminal without the use of sudo and the error "RVM is not a function, selecting rubies with 'rvm use ...' will not work." will be eliminated.

Cheers.

查看更多
柔情千种
4楼-- · 2019-01-01 10:16

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.

查看更多
回忆,回不去的记忆
5楼-- · 2019-01-01 10:16

I had the same error, but none of the solutions on this page seemed to work. For me it was enough to add the rvm executable to my path:

PATH=$PATH:/usr/local/rvm/bin/

Et voila!

查看更多
后来的你喜欢了谁
6楼-- · 2019-01-01 10:18

I'd got the same error because I'd ever installed the old rvm version ruby-rvm with the apt-get command.

I solved the problem by remove the script line to config the old rvm in .bashrc file.

Check the old rvm config script and then run source .profile

查看更多
皆成旧梦
7楼-- · 2019-01-01 10:18

I fixed it by adding this line to .bash_profile:

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
查看更多
登录 后发表回答