Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using RVM, how to ensure gems and non-gems see the same version of ruby?

I'm trying to install bdb on Ubuntu as a gem as follows,

gem install bdb

I'm not using sudo, since I am installing with rvm. The ruby version on my system is 1.9.1 but the version I'm using for this installation is 1.8.7 (I'm installing rbot, you see). The problem I've encountered is:

checking for db_version() in -ldb-4.something... no

I assume this means that rubygems is not finding ldb4.something in the places it is looking. Is this because I installed libdb-4.something (7, actually) using sudo, and my system's ruby version is different from the ruby version I'm using for bdb? Using rvm, how should I manage this sort of situation? Maybe I'm doing things wrong, but it seems to me that my problem is that not everything I'm using is a gem, and the stuff that isn't gems is seeing the wrong version of ruby.

(if it turns out that my problem is something completely unrelated: I am still interested in the question. How do things I've installed on my system with a particular version of ruby get along with gems installed using rvm under different versions of ruby?)

like image 694
Ziggy Avatar asked Oct 11 '22 02:10

Ziggy


1 Answers

"How do things I've installed on my system with a particular version of ruby get along with gems installed using RVM under different versions of ruby?"

They don't, and that is the point. RVM is for managing different versions of Ruby so that they are isolated from each other.

This means that the Ruby versions that you use for system (when you do sudo gem install that would be installing to system) have nothing to do with the current environment (when properly set up.)

When you are in a RVM environment, each version of Ruby installed is an isolated environment.

What I would recommend is this:

  1. Go to the RVM Website and check it out.
  2. At the end of the page, continue with your reading about how to use gemsets.
  3. go to your project directory
  4. rvm use 1.8.7@your_project_environment
  5. create your .rvrmc file so that you will automatically be using this environment in your project on the future visits to this project, this file can contain "rvm use 1.8.7@your_project_environment" which will achieve this.
  6. install all required gems

If you have additional questions, feel free to visit Wayne E. Seguin and a ton of other users of RVM and we will be happy to help you out. Of course, the first search for answers is the documentation on the web site.

like image 146
vgoff Avatar answered Oct 15 '22 10:10

vgoff