Forum: Ruby on Rails setting GEM_PATH in environment.rb

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
34f5b045aec62235c17458650ea75353?d=identicon&s=25 Steve Koppelman (hatless)
on 2007-02-28 22:22
This isn't a hosting-related question. I'm not looking for a way to set
the GEM_PATH in a shell script.

Instead, I'm trying to load gems from both the systemwide gem path and
from a directory of app-specific gems I've placed in

I have installed my app-specific gems from my app's root with

  gem install --install-dir lib/gems gemname

Now in lib/gems I have the usual set of subdirs -- cache, bin, gems, doc
and specifications. So far, so good.

In environment.rb immediately after the line that reads as follows:

  require File.join(File.dirname(__FILE__), 'boot')

I have added the following:

  #Yes, this is where my default gems reside. They all work.
  ENV['GEM_HOME'] = "#{RAILS_ROOT}/../../ext/ruby/lib/ruby/gems/1.8"

  #However, the gems in the second part of this GEM_PATH don't load.

How do I get those additional gems to load? If I put rcov in my main gem
repo, it will load when I invoke "require 'rcov'". If I install it to
the secondary path, it will not.

This topic is locked and can not be replied to.