Adam Harte
Adam Harte

Reputation: 10530

Using RVM, but can't set current Ruby version (Ubuntu 11.10)

I have recently installed RVM on a fresh install of Ubuntu 11.10 and can not work out how to start using a particular ruby version.

I have installed Ruby 1.8.7 and 1.9.2, and they show up in the list fine:

$ rvm list
rvm rubies
   ruby-1.8.7-p352 [ i386 ]
   ruby-1.9.2-p290 [ i386 ]

When I try to use the "use" command, everything seems fine:

$ rvm use 1.9.2
Using /usr/share/ruby-rvm/gems/ruby-1.9.2-p290
Running /usr/share/ruby-rvm/hooks/after_use

But then when I test the current ruby version, I get the usual Ubuntu 11.10 message you get when you don't have RVM at all:

$ ruby -v
The program 'ruby' can be found in the following packages:
 * ruby1.8
 * ruby1.9.1
Try: sudo apt-get install <selected package>

What am I doing wrong? Did I miss out a step in the RVM installation or something?

EDIT*

Answers to some comments:

$ which ruby
#returns nothing at all.

$ which rvm 
/usr/bin/rvm

$ rvm -v
rvm 1.6.9 by Wayne E. Seguin ([email protected]) [https://rvm.beginrescueend.com/]

$ echo $PATH
/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games

Upvotes: 8

Views: 5974

Answers (4)

Alan Owens
Alan Owens

Reputation: 11

I know this thread is zombie-old, but in your terminal client's preferences, checking 'run command as login shell' solved it for me. RVM generally puts that line in your ~/.bash_profile for you.

Upvotes: 1

Remear
Remear

Reputation: 1937

RVM 1.6.9 is very old now. Did you install it through some package manager? If so, get rid of it and run the following in your bash shell:

curl -L https://get.rvm.io | bash -s stable

Then, place [[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" in ~/.profile OR ~/.bash_profile OR ~/.bashrc

You should then be able to run type rvm | head -n 1 and it should say "rvm is a function".

Then you should be able to install rubies and use one of them. Be sure to use --default for that Ruby to remain the default even after you end your terminal session. E.g. rvm use ruby-1.9.2-p290 --default

Upvotes: 9

Filip
Filip

Reputation: 128

Like tass suggested you obviously have a different rvm directory then $HOME/.rvm so

[[ -s "/usr/share/ruby-rvm/scripts/rvm" ]] && . "/usr/share/ruby-rvm/scripts/rvm"

is probably what you would to use instead

Upvotes: 1

0x4a6f4672
0x4a6f4672

Reputation: 28245

Have you added the following line to your .bash_profile,

[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"

as the installation page for rvm says?

Upvotes: 1

Related Questions