# Must .gemrc -\> gemhome point to Gems installation?

**URL:** <https://rubytalk.org/t/must-gemrc-gemhome-point-to-gems-installation/16843>\
**Category:** ruby-talk\
**Created:** [8 March 2005 06:09 UTC](https://rubytalk.org/t/must-gemrc-gemhome-point-to-gems-installation/16843 "2005-03-08T06:09:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Anonymous\_Coward](https://avatars.discourse-cdn.com/v4/letter/a/94ad74/32.png) [@Anonymous\_Coward](https://rubytalk.org/u/Anonymous_Coward)\
**Post date:** [8 March 2005 06:09 UTC](https://rubytalk.org/t/must-gemrc-gemhome-point-to-gems-installation/16843/1 "2005-03-08T06:09:09Z")

</div>

On my system, anything in the gemhome field in .gemrc seems to render  
Gems unusable. Here's some output for your viewing pleasure:

# Version  
05:45:46 ruerue@purr\> ruby -v  
ruby 1.8.2 (2004-12-25) [i686-linux]

05:51:28 ruerue@purr\> gem --version  
0.8.6

# This is what I'd like to have  
05:51:35 ruerue@purr\> cat .gemrc  
gem: --gen-rdoc --run-tests  
rdoc: --all --line-numbers --inline-source  
gemhome: /home/ruerue/lib/ruby  
gempath:  
&nbsp;&nbsp;&nbsp;- /usr/lib/ruby/site\_ruby/1.8/rubygems

# But then this happens  
05:51:55 ruerue@purr\> gem install -r og  
Attempting remote installation of 'og'  
/usr/lib/ruby/site\_ruby/1.8/rubygems.rb:131:in `activate': (Gem::LoadError)  
Could not find RubyGem sources (\> 0.0.0)  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from /usr/lib/ruby/site\_ruby/1.8/rubygems.rb:34:in `require\_gem'  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# Backtrace snipped

# I can change it to the default location, but to no avail  
05:57:54 ruerue@purr\> nano -w .gemrc

06:00:36 ruerue@purr\> cat .gemrc  
gem: --gen-rdoc --run-tests  
rdoc: --all --line-numbers --inline-source  
gemhome: /usr/lib/ruby/site\_ruby/1.8/rubygems  
gempath:  
&nbsp;&nbsp;&nbsp;- /usr/lib/ruby/site\_ruby/1.8/rubygems

06:00:39 ruerue@purr\> gem install -r og  
Attempting remote installation of 'og'  
/usr/lib/ruby/site\_ruby/1.8/rubygems.rb:131:in `activate': (Gem::LoadError)  
Could not find RubyGem sources (\> 0.0.0)  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from /usr/lib/ruby/site\_ruby/1.8/rubygems.rb:34:in `require\_gem'  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# ...

# Removing it works, though  
06:00:48 ruerue@purr\> nano -w .gemrc

06:04:11 ruerue@purr\> cat .gemrc  
gem: --gen-rdoc --run-tests  
rdoc: --all --line-numbers --inline-source  
gempath:  
&nbsp;&nbsp;&nbsp;- /usr/lib/ruby/site\_ruby/1.8/rubygems

06:04:15 ruerue@purr\> gem install -r og  
Attempting remote installation of 'og'  
Install required dependency extensions? [Yn]

---

<div class="post-metadata">

**Author:** ![Jim\_Weirich1](https://avatars.discourse-cdn.com/v4/letter/j/73ab20/32.png) [@Jim\_Weirich1](https://rubytalk.org/u/Jim_Weirich1)\
**Post date:** [8 March 2005 12:20 UTC](https://rubytalk.org/t/must-gemrc-gemhome-point-to-gems-installation/16843/2 "2005-03-08T12:20:46Z")

</div>

The reason it is failing is that gems requires a "sources" gem be available to  
tell it where to the sites to use to get remote gems. You can work around  
this by putting the standard gem repository in the gem path, while leaving  
the new gemhome be the target for new installations.

Here's what worked for me on my linux system.

First, with an unmodified .gemrc file, find the directory of the current gem  
home:

&nbsp;&nbsp;$ gem env gemdir  
&nbsp;&nbsp;/usr/local/lib/ruby/gems/1.8

Now edit .gemrc to contain ...

&nbsp;&nbsp;gem: --gen-rdoc --run-tests  
&nbsp;&nbsp;rdoc: --all --line-numbers --inline-source  
&nbsp;&nbsp;gemhome: /home/ruerue/lib/ruby  
&nbsp;&nbsp;gempath:  
&nbsp;&nbsp;&nbsp;&nbsp;- /usr/local/lib/ruby/gems/1.8

Now the .gemrc file will direct all new installations to  
the /home/ruerue/lib/ruby directory.

It would be nice to have a way of initializing a new gem home directory with  
the sources package. Then you wouldn't need to have the original gem  
directory in the gem path. I suppose you could do it by hand, but I haven't  
tried it.

> **···**
>
> On Tuesday 08 March 2005 01:09 am, ES wrote:
> 
> > On my system, anything in the gemhome field in .gemrc seems to render  
> > Gems unusable.
> 
> --  
> -- Jim Weirich jim@weirichhouse.org [http://onestepback.org](http://onestepback.org)  
> -----------------------------------------------------------------  
> "Beware of bugs in the above code; I have only proved it correct,  
> not tried it." -- Donald Knuth (in a memo to Peter van Emde Boas)

---

<div class="post-metadata">

**Author:** ![Anonymous\_Coward](https://avatars.discourse-cdn.com/v4/letter/a/94ad74/32.png) [@Anonymous\_Coward](https://rubytalk.org/u/Anonymous_Coward)\
**Post date:** [8 March 2005 16:29 UTC](https://rubytalk.org/t/must-gemrc-gemhome-point-to-gems-installation/16843/3 "2005-03-08T16:29:41Z")

</div>

Jim Weirich wrote:

> > On my system, anything in the gemhome field in .gemrc seems to render  
> > Gems unusable.
> 
> The reason it is failing is that gems requires a "sources" gem be available to tell it where to the sites to use to get remote gems. You can work around this by putting the standard gem repository in the gem path, while leaving the new gemhome be the target for new installations.
> 
> Here's what worked for me on my linux system.
> 
> First, with an unmodified .gemrc file, find the directory of the current gem home:
> 
> &nbsp;&nbsp;$ gem env gemdir  
> &nbsp;&nbsp;/usr/local/lib/ruby/gems/1.8
> 
> Now edit .gemrc to contain ...
> 
> &nbsp;&nbsp;gem: --gen-rdoc --run-tests  
> &nbsp;&nbsp;rdoc: --all --line-numbers --inline-source  
> &nbsp;&nbsp;gemhome: /home/ruerue/lib/ruby  
> &nbsp;&nbsp;gempath:  
> &nbsp;&nbsp;&nbsp;&nbsp;- /usr/local/lib/ruby/gems/1.8
> 
> Now the .gemrc file will direct all new installations to the /home/ruerue/lib/ruby directory.

Thanks for the idea! I had tried it already, though, but no luck. I'm  
thinking it's probably got something to do with how Gentoo packages  
RubyGems. I'll look into it. In the meanwhile I'm using --install-dir  
and put my library path in gempath instead.

> It would be nice to have a way of initializing a new gem home directory with the sources package. Then you wouldn't need to have the original gem directory in the gem path. I suppose you could do it by hand, but I haven't tried it.

Maybe you can just separate RUBYGEMS\_HOME from GEM\_HOME?

E

> **···**
>
> > On Tuesday 08 March 2005 01:09 am, ES wrote:
