2

I just installed RVM on a Debian 6 server, without having any problem in the beginning. However after everything is set up, I can't run RVM in the terminal. The message I get when I type rvm use is:

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 am logging in via SSH and can´t find a solution for this problem. In "rvm installation not working: "RVM is not a function"" they managed to solve the problem but not for SSH.

Community
  • 1
  • 1
Diego
  • 63
  • 1
  • 5
  • Please read the *entire* [installation page](http://rvm.io/rvm/install), including the troubleshooting information toward the bottom of the page. If that doesn't help I'd recommend asking for help in the RVM IRC channel. RVM works fine remotely; I have it on multiple machines accessed via SSH. – the Tin Man Dec 29 '13 at 05:34

3 Answers3

3

run:

rvm get stable --auto-dotfiles

it will remove and re-add rvm lines from shell initialization files

for ssh connections to work you need to set your shell as bash(preferred) or zsh, you can check your current shell with:

getent passwd $USER | awk -F: '{print $NF}'

and if it is not bash/zsh change it with:

chsh $USER --shell `which bash`
mpapis
  • 52,729
  • 14
  • 121
  • 158
1

You need to source /etc/profile.d/rvm.sh first. Add the following line to your .bashrc (or type it at the prompt) :

source /etc/profile.d/rvm.sh

Alternatively, if you need a function, the following script works for me :

#!/bin/sh

#RVM stuff
# Load RVM into a shell session *as a function*
if [[ -s "$HOME/.rvm/scripts/rvm" ]] ; then

  # First try to load from a user install
  source "$HOME/.rvm/scripts/rvm"

elif [[ -s "/usr/local/rvm/scripts/rvm" ]] ; then

  # Then try to load from a root install
  source "/usr/local/rvm/scripts/rvm"

else

  printf "ERROR: An RVM installation was not found.\n"

fi
svvac
  • 5,814
  • 3
  • 17
  • 22
  • It's not working, just tried the first solution and it isn't working. The same message appears. – Diego Dec 29 '13 at 00:00
  • Well, that's what solved the exact same problem on my Debian squeeze box... Sorry to hear it doesn't work for you. – svvac Dec 29 '13 at 00:14
  • @swordofpain where do you put your script? I assume it loads on every boot. – sayth May 24 '14 at 00:51
-1

When SSH launches bash, bash doesn't source .bashrc, in default builds (there is a compile-time flag, SSH_SOURCE_BASHRC, that forces it to). Try using something like this in your SSH command line:

ssh user@host "bash -i"

See ssh command execution doesn't consider .bashrc | .bash_login | .ssh/rc?.

Community
  • 1
  • 1
echristopherson
  • 6,974
  • 2
  • 21
  • 31