# RubyGems break because Ruby has both site\_ruby and vendor\_ruby

**URL:** <https://www.ruby-forum.com/t/rubygems-break-because-ruby-has-both-site-ruby-and-vendor-ruby/121912>\
**Category:** Rails\
**Created:** [December 2, 2007, 8:45pm UTC](https://www.ruby-forum.com/t/rubygems-break-because-ruby-has-both-site-ruby-and-vendor-ruby/121912 "2007-12-02T20:45:38Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ray](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e9a140/32.png) [@ray](https://www.ruby-forum.com/u/ray)\
**Post date:** [December 2, 2007, 8:45pm UTC](https://www.ruby-forum.com/t/rubygems-break-because-ruby-has-both-site-ruby-and-vendor-ruby/121912/1 "2007-12-02T20:45:38Z")

</div>

I just installed Ruby and RubyGems using MacPorts and a whole bunch of  
gems. I am trying to run a Rails project that works on Ubuntu, but  
now I am trying to make it run on Leopard. I got an error when I just  
run script/console:

jamison:redesign rlaw$ script/console  
Loading development environment.  
/opt/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/  
active\_support/dependencies.rb:477:in `const\_missing’:NameError:  
uninitialized constant Gem::Version::NUM\_RE

I find it awk Gem::Version::NUM\_RE is not initialized. I then traced  
and found that I have two Ruby directories:

jamison:ruby rlaw$ ls -alF  
total 0  
drwxr-xr-x 6 root admin 204 Dec 2 13:55 ./  
drwxrwxr-x 167 root admin 5678 Dec 1 07:14 …/  
drwxr-xr-x 111 root admin 3774 Dec 1 03:47 1.8/  
drwxr-xr-x 3 root admin 102 Dec 1 04:01 gems/  
drwxr-xr-x 4 root admin 136 Dec 1 03:47 site\_ruby/  
drwxr-xr-x 4 root admin 136 Dec 1 03:47 vendor\_ruby/

And my Ruby $LOAD\_PATH is as follow:

> > puts $LOAD\_PATH  
> > /opt/local/lib/ruby/site\_ruby/1.8  
> > /opt/local/lib/ruby/site\_ruby/1.8/i686-darwin9.1.0  
> > /opt/local/lib/ruby/site\_ruby  
> > /opt/local/lib/ruby/vendor\_ruby/1.8  
> > /opt/local/lib/ruby/vendor\_ruby/1.8/i686-darwin9.1.0  
> > /opt/local/lib/ruby/vendor\_ruby  
> > /opt/local/lib/ruby/1.8  
> > /opt/local/lib/ruby/1.8/i686-darwin9.1.0  
> > .

Things in site\_ruby and vendor\_ruby are obviously different.  
Specifically, /opt/local/lib/ruby/vendor\_ruby/1.8/rubygems/version.rb  
has NUM\_RE defined but /opt/local/lib/ruby/site\_ruby/1.8/rubygems/  
version.rb does not. Since Ruby looks in site\_ruby first, that’s  
exactly why it breaks. So my solution is to swap site\_ruby and  
vendor\_ruby, and it works.

However, why are there two directories, site\_ruby and vendor\_ruby?  
How did it end up like this? Is there any repercussion if I swap  
them?

Ray

---

<div class="post-metadata">

**Author:** ![ray](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e9a140/32.png) [@ray](https://www.ruby-forum.com/u/ray)\
**Post date:** [December 19, 2007, 5:13pm UTC](https://www.ruby-forum.com/t/rubygems-break-because-ruby-has-both-site-ruby-and-vendor-ruby/121912/2 "2007-12-19T17:13:14Z")

</div>

I fixed this on my project by putting this in my environment above the  
initializer:

module Gem  
class Version  
NUM\_RE = /\s\*(\d+(.\d+)_)_\s\*/  
end  
end

- Ola
