RubyGems break because Ruby has both site_ruby and vendor_ruby

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.
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:


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


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

module Gem
class Version
NUM_RE = /\s*(\d+(.\d+))\s*/

  • Ola

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs