views:

69

answers:

2

On ubuntu here. I installed both ruby1.8 and ruby1.9.1. I also ran these commands

ruby1.8 setup.rb
ruby1.9.1 setup.rb

Both worked fine, I was also able to install gems for both. The gems in gem 1.9.1 and gem1.8 both show up correctly for gem list. The problems however begin with this: ruby1.9.1 some_script.rb. It cannot find any of the gems. I tried uncommenting some out figuring that parseconfig was the problem, yet it couldn't find any of the others, which are definetly in gem1.9.1 list. Any thoughts as to what is causing this/how to recover?

edit/side note: ruby1.9.1 won't be able to find the gems in 1.8 either. Not that I want that! Just clarifying

From pejuko's answer!:

 cd /var/lib/
 cd gems
 bash: cd: gems: No such file or directory
 sudo ln -s /usr/lib/ruby/gems

 irb1.9.1
 irb(main):001:0> require 'mechanize'
 => true

This fixed it! Also, screw debian.

A: 

you probably need to add a require 'rubygems' to the top of your scripts. this will instruct ruby to load up the gem system and you'll then be able to find all of your gems from the ruby 1.9.1 runtime.

Derick Bailey
This is at the top of each file. The thing is I removed rubygems from synaptic package manager and installed it from rubyforge instead.
Zombies
+1  A: 

Hi, I don't know if this is the case, but when I installed rubygems from rubyforge I needed to create some symlinks because ubuntu uses different directory for gems then the original one. I have in directory /usr/lib/ruby/ gems symlinked to /var/lib/gems/

pejuko