Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I'm getting "RVM is not a function" error on Mac OS X, and no posted solutions work

Tags:

ruby

rvm

I'm on Mac OS x 10.8.2 ("Mountain Lion"), and I successfully installed RVM 1.17.8 and its dependencies. I'm able to use it to install Ruby versions using rvm install 1.9.2, but I can't execute rvm use <version> without getting this error:

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.

I have the following in ~/.bash_profile, which I have set to run, using source ~/.bash_profile, whenever a terminal window is launched:

export SVN_EDITOR=vim
PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting
[ -r ~/.bashrc ] && source ~/.bashrc

I've tried running source ~/.rvm/scripts/rvm, which runs without returning an error, but I still get the "RVM is not a function" error when I try to use RVM to set the Ruby version within the terminal session.

I also tried uninstalling and reinstalling RVM using rvm implode. I've run out of ideas and I can't seem to find any more solutions online. Help?

like image 740
user1623749 Avatar asked Jan 12 '13 01:01

user1623749


2 Answers

Make sure your shell initialization files are set up properly:

rvm get head --auto-dotfiles

Then go to your terminal emulator preferences and enable login shell, sometimes it it required to use /bin/bash --login. Also make sure to fully close terminal and open it fresh after changing the setting.

like image 108
mpapis Avatar answered Nov 12 '22 02:11

mpapis


The solution ended up being on the RVM Help & Support page, in the ".bash_profile not being loaded on OSX" section. It seems that the issue was that I had my terminal set to open with the "default login shell" and when I changed it to instead open with the command "/usr/bash" in Preferences/Setup, "source ~/.rvm/scripts/rvm" started working, and rvm is now being recognized as a function.

like image 20
user1623749 Avatar answered Nov 12 '22 03:11

user1623749