Possible Duplicate:
Cannot use RVM-installed Ruby with sudo
I’m running into the same “RVM is not a function…” error when executing the command sudo rvm use 1.9.3 as everyone else, but try as I might, I cannot seem to resolve it. I’ve read and followed through with all of the common troubleshooting tips, but nothing seems to work…
My System — OS: Ubuntu 12.10 — Ruby Version: 1.9.3 — RVM Version: 1.18.3
I have done the following to try to repair the issue:
- Checked the ‘Run command as login shell’ option in the “Title and Command” tab for Terminal preferences
-
Added the following code block to ~/.bashrc, ~/.bash_profile, ~/.zshrc, and ~/.zprofile
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"if test -f ~/.rvm/scripts/rvm; then
[ "$(type -t rvm)" = "function" ] || source ~/.rvm/scripts/rvmfi`
-
Running
user$ source ~/.rvm/scripts/rvmand thenuser$ type rvm | head -n 1DOES returnrvm is a function. But then runningsudo rvm use 1.9.3returns “RVM is not a function”
What else can I do to resolve this issue?
You can not run rvm with
sudo, sudo is running a new process which defeats thefunctionapproach which can change current running shell environment.