2

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:

  1. Checked the 'Run command as login shell' option in the "Title and Command" tab for Terminal preferences
  2. 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/rvm fi`

  3. Running user$ source ~/.rvm/scripts/rvm and then user$ type rvm | head -n 1 DOES return rvm is a function. But then running sudo rvm use 1.9.3 returns "RVM is not a function"

What else can I do to resolve this issue?

Community
  • 1
  • 1

1 Answers1

0

You can not run rvm with sudo, sudo is running a new process which defeats the function approach which can change current running shell environment.

mpapis
  • 52,729
  • 14
  • 121
  • 158
  • Right. Looks like `sudo` was the problem here. Not using sudo allows RVM to run. I didn't know that sudo would be running a new process and defeat the `function` approach. Thanks for the help! – Eric Longoria Jan 28 '13 at 01:13