[Rubygems-developers] /etc/gemrc and GEM_PATH behaviour

Amanda Waite Amanda.Waite at Sun.COM
Mon Sep 1 05:18:31 EDT 2008

Hi there,

I've been working on OS level packaging of some Ruby Gems on 
OpenSolaris. I had hoped to be able to use /etc/gemrc to specify the gem 
search path, but I've found that setting gempath in /etc/gemrc only 
affects the running of the gem command and not the running/loading of 
gems themselves. I've worked through the code as best I can and it seems 
to come down to the GemRunner class creating a Gem::ConfigFile instance 
which then reads the /etc/gemrc file. The gempath and gemhome values are 
then pushed into the Gem.path via the use_paths method in rubygems.rb. 
This code path is only used when running the gem command. For running 
Gems (like rails) or loading gems in scripts, the value for default_path 
is used unless GEM_PATH is set. In this case the ConfigFile is never loaded.

Is there any documentation that describes the intended behaviour of 
/etc/gemrc? I've looked around but most of what I've found relates to 
.gemrc and much of that is anecdotal.



More information about the Rubygems-developers mailing list