Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ruby 1.9.1 Load Path Craziness

Ok, I've just spent the 4 hours trying to figure this one out without success. I've tried all the usual suspects and googled every combination of ruby 1.9.1, load path, gems, mac os x,freebsd,prawn and other stuff. The bottom line is this:

When I compile ruby1.9.1-p129 from sources on mac os x 10.5, the default load path ($:) I get is:

ruby -e "puts $:"
/usr/local/lib/ruby/gems
/usr/local/lib/ruby/site_ruby/1.9.1
/usr/local/lib/ruby/site_ruby/1.9.1/i386-darwin9.7.0
/usr/local/lib/ruby/site_ruby
/usr/local/lib/ruby/vendor_ruby/1.9.1
/usr/local/lib/ruby/vendor_ruby/1.9.1/i386-darwin9.7.0
/usr/local/lib/ruby/vendor_ruby
/usr/local/lib/ruby/1.9.1
/usr/local/lib/ruby/1.9.1/i386-darwin9.7.0
.

when I install the prawn gem, for example, I get:

gem which prawn
(checking gem prawn-0.5.0.1 for prawn)
/prawn.rb

and when I try to require it I get:

ruby -e "require 'prawn'"
-e:1:in `require': no such file to load -- prawn (LoadError)
    from -e:1:in `'

The only way I've been able to resolve this is by doing something stupid like this:

$: << "/usr/local/lib/ruby/gems/1.9.1/gems/prawn-0.5.0.1/lib"

which, of course, is utterly ridiculous. So the question is how do I get ruby 1.9.1 to recognize and follow the correct gems path? I've never had this issue with 1.8.7 so I'm assuming it 1.9.1 specific. I feel I'm missing something completely obvious here and any help would be much appreciated!

like image 777
ennuikiller Avatar asked Dec 06 '22 05:12

ennuikiller


1 Answers

setting GEM_PATH=/usr/local/lib/ruby/gems/1.9.1

solved the problem. I knew it was something simple. Just aggravates me that it took ALL DAY to figure out!! This is due to never having this issue with 1.8.7 and of course NOT RTFM!!

like image 189
ennuikiller Avatar answered Jan 02 '23 03:01

ennuikiller