views:

72

answers:

2

I'm a bit of a Linux noob trying to get ruby, rails, mysql and sqlite all playing nicely on ubuntu 10. I am getting errors, and I realized that the versions are different for sudo versus normal user!

mpw@ubuntu:~/.rvm/gems/ruby-1.9.2-p0$ gem --version
1.3.7
mpw@ubuntu:~/.rvm/gems/ruby-1.9.2-p0$ sudo gem --version
1.3.5

I have used RVM to install it, but it seems that I have conflicting versions. How to fix?

A: 

sudo gem --version most likely is using the system gem i.e the one you get when you do rvm system. This is because sudo changes user to root and you probably didn't do sudo rvm use 1.9.2 or something similar. Try doing sudo which gem and which gem to confirm this.

You can update the version used by root by doing sudo gem update --system. However note that you are still most likley using different gem paths when using sudo gem and gem if you are not using the system gem executable by default i.e rvm use system.

Mahmoud
A: 

I did the same installation mistake before, but following these instructions worked. http://ascarter.net/2010/05/10/rails-development-on-ubuntu-10.04.html

arscariosus
Speaking from experience, it's better to just use RVM and save yourself all the trouble with the Ubuntu packages. Chances are you'd want to run several versions of Ruby anyway, some of them more up-to-date than the ones in the Ubuntu repos.
Lars Haugseth