Search code examples
rubyrails-agnostic

ruby1.9.1 can't find installed gems, yet ruby1.8 can


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.


Solution

  • 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/