Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

[Debian squeeze]

It has been surprisingly difficult to find an answer for this.

I had ruby v1.9.1 installed (/usr/bin/ruby1.9.1), but after I then installed rubygems, it also installed ruby1.8 (/usr/bin/ruby1.8), and all the commands I run on gem (gem install ..., rails ...) are all using ruby v1.8.

~/proj/rails/demo# bundle show sqlite3
/var/lib/gems/1.8/gems/sqlite3-1.3.4

How do I get rubygems and rails to use the v1.9.1 which I have installed, instead of v1.8?

(side note: I did install rvm using "gem install rvm", but after I did that, I am not able to execute rvm, what's up with that?)

share|improve this question
add comment

3 Answers

Did you update /etc/alternatives? On the ubuntu side of things, you'd run "sudo update-alternatives", and tell the system what the symlink for "/usr/bin/ruby", "/usr/bin/gem", etc., actually point to. I'm not sure if "update-alternatives" is in Debian, but there should be a similar method of pointing at the version you want.

Hmm. This is a bit old, but is probably applicable:

http://kangaroobox.blogspot.com/2009/12/switching-ruby-platforms-on-debian.html

share|improve this answer
add comment

On Debian the rubygems package is just a meta-package which depends on rubygems1.8, the same way ruby just depends on ruby1.8. Thus, if you want rubygems for 1.9, you need to install rubygems1.9. The gem command (as all other potential executables like ruby, irb or ri) is just a symlink pointing to the preferred version like gem1.8. You can use those directly or you can use update-alternatives to set the preferred version.

Regarding RVM, it's true that there is a gem but it contains just some helpers for RVM. RVM doesn't require a pre-installed ruby. In fact, often it is used as the single way to install rubies on systems.

To actual install RVM, run

bash < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer )

as described on RVM's install guide. Please refer to it for more information about various install variants.

share|improve this answer
add comment

You need to use RVM (Ruby Version Manager), which can switch ruby versions easily.

To shift to Ruby version 1.9.1, try

rvn use 1.9.1

to make this version default, use

rvn use 1.9.1 --default

If you need to learn about basics of rvm, please follow this tutorial, which explains some more details about how to use RVM.

http://beginrescueend.com/rvm/basics/

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.