# Gems in userdir - Could not find RubyGem

**URL:** <https://www.ruby-forum.com/t/gems-in-userdir-could-not-find-rubygem/93412>\
**Category:** Ruby\
**Created:** [April 2, 2006, 4:16am UTC](https://www.ruby-forum.com/t/gems-in-userdir-could-not-find-rubygem/93412 "2006-04-02T04:16:06Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![subroutine](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/fbc32d/32.png) [@subroutine](https://www.ruby-forum.com/u/subroutine)\
**Post date:** [April 2, 2006, 4:16am UTC](https://www.ruby-forum.com/t/gems-in-userdir-could-not-find-rubygem/93412/1 "2006-04-02T04:16:06Z")

</div>

Hi,

I am new to ruby and gem and I have installed a few gems (rails and  
deps) in userdir.

$ HOME=$HOME/html gem list rails

\*\*\* LOCAL GEMS \*\*\*

rails (1.1.0)  
Web-application framework with template engine, control-flow layer,  
and ORM.

So gem seems to find the installed rails but:

$ HOME=$HOME/html ruby/bin/rails  
/usr/lib/ruby/1.8/rubygems.rb:204:in `report_activate_error': Could not find RubyGem rails (> 0) (Gem::LoadError) from /usr/lib/ruby/1.8/rubygems.rb:141:in`activate’  
from /usr/lib/ruby/1.8/rubygems.rb:37:in  
`require_gem_with_options' from /usr/lib/ruby/1.8/rubygems.rb:31:in`require\_gem’  
from ruby/bin/rails:17

In $HOME/html is a .gemrc file with configured gemhome and gempath.

So what I have to do so that the gem is found at execution?

Thanks  
Markus

---

<div class="post-metadata">

**Author:** ![subroutine](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/fbc32d/32.png) [@subroutine](https://www.ruby-forum.com/u/subroutine)\
**Post date:** [April 2, 2006, 12:50pm UTC](https://www.ruby-forum.com/t/gems-in-userdir-could-not-find-rubygem/93412/2 "2006-04-02T12:50:37Z")

</div>

Markus K. wrote:

> ```
> Web-application framework with template engine, control-flow layer,
> from /usr/lib/ruby/1.8/rubygems.rb:37:in `require_gem_with_options'
> from /usr/lib/ruby/1.8/rubygems.rb:31:in `require_gem'
> from ruby/bin/rails:17
> 
> ```
> 
> In $HOME/html is a .gemrc file with configured gemhome and gempath.
> 
> So what I have to do so that the gem is found at execution?

Some additional info:

$ irb  
irb(main):001:0\> require ‘rubygems’  
=\> true  
irb(main):002:0\> require\_gem ‘rake’  
Gem::LoadError: Could not find RubyGem rake (\> 0.0.0)

```
    from /usr/lib/ruby/1.8/rubygems.rb:204:in 

```

`report_activate_error' from /usr/lib/ruby/1.8/rubygems.rb:141:in`activate’  
from /usr/lib/ruby/1.8/rubygems.rb:37:in  
`require_gem_with_options' from /usr/lib/ruby/1.8/rubygems.rb:31:in`require\_gem’  
from (irb):2  
irb(main):003:0\> require ‘rake’  
=\> true  
irb(main):004:0\>

So rake.rb is found but require\_gem doesn’t find gem rake?!

Please, please, help me 😉

---

<div class="post-metadata">

**Author:** ![subroutine](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/fbc32d/32.png) [@subroutine](https://www.ruby-forum.com/u/subroutine)\
**Post date:** [April 2, 2006, 1:00pm UTC](https://www.ruby-forum.com/t/gems-in-userdir-could-not-find-rubygem/93412/3 "2006-04-02T13:00:40Z")

</div>

Markus K. wrote:

> Markus K. wrote:
> 
> > ```
> > Web-application framework with template engine, control-flow layer,
> > from /usr/lib/ruby/1.8/rubygems.rb:37:in `require_gem_with_options'
> > from /usr/lib/ruby/1.8/rubygems.rb:31:in `require_gem'
> > from ruby/bin/rails:17
> > 
> > ```
> > 
> > In $HOME/html is a .gemrc file with configured gemhome and gempath.
> > 
> > So what I have to do so that the gem is found at execution?
> 
> Some additional info:
> 
> $ irb  
> irb(main):001:0\> require ‘rubygems’  
> =\> true  
> irb(main):002:0\> require\_gem ‘rake’  
> Gem::LoadError: Could not find RubyGem rake (\> 0.0.0)
> 
> ```
> from /usr/lib/ruby/1.8/rubygems.rb:204:in 
> 
> ```
> 
> `report_activate_error' from /usr/lib/ruby/1.8/rubygems.rb:141:in`activate’  
> from /usr/lib/ruby/1.8/rubygems.rb:37:in  
> `require_gem_with_options' from /usr/lib/ruby/1.8/rubygems.rb:31:in`require\_gem’  
> from (irb):2  
> irb(main):003:0\> require ‘rake’  
> =\> true  
> irb(main):004:0\>
> 
> So rake.rb is found but require\_gem doesn’t find gem rake?!
> 
> Please, please, help me 😉

Perhaps rake is also installed as a non-gem?

Add a list of user repositories to the GEM\_PATH environment variable.

–  
– Jim W.

---

<div class="post-metadata">

**Author:** ![subroutine](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/fbc32d/32.png) [@subroutine](https://www.ruby-forum.com/u/subroutine)\
**Post date:** [April 2, 2006, 1:46pm UTC](https://www.ruby-forum.com/t/gems-in-userdir-could-not-find-rubygem/93412/4 "2006-04-02T13:46:11Z")

</div>

Jim W. wrote:

> Markus K. wrote:
> 
> > Markus K. wrote:  
> > […]
> 
> > Gem::LoadError: Could not find RubyGem rake (\> 0.0.0)  
> > […]
> 
> > irb(main):003:0\> require ‘rake’  
> > =\> true  
> > irb(main):004:0\>
> > 
> > So rake.rb is found but require\_gem doesn’t find gem rake?!  
> > […]  
> > Add a list of user repositories to the GEM\_PATH environment variable.

Thank you Jim.  
Oh, yes, with environment variable GEM\_PATH it works. Why not with  
…gemrc gempath? Seems that only the gem tool uses that config.

Markus

---

<div class="post-metadata">

**Author:** ![subroutine](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/fbc32d/32.png) [@subroutine](https://www.ruby-forum.com/u/subroutine)\
**Post date:** [April 2, 2006, 7:17pm UTC](https://www.ruby-forum.com/t/gems-in-userdir-could-not-find-rubygem/93412/5 "2006-04-02T19:17:27Z")

</div>

Markus K. wrote:

> Jim W. wrote:
> 
> > Markus K. wrote:
> > 
> > > Markus K. wrote:  
> > > […]
> > 
> > > Gem::LoadError: Could not find RubyGem rake (\> 0.0.0)  
> > > […]
> > 
> > > irb(main):003:0\> require ‘rake’  
> > > =\> true  
> > > irb(main):004:0\>
> > > 
> > > So rake.rb is found but require\_gem doesn’t find gem rake?!  
> > > […]  
> > > Add a list of user repositories to the GEM\_PATH environment variable.
> 
> Thank you Jim.  
> Oh, yes, with environment variable GEM\_PATH it works. Why not with  
> …gemrc gempath? Seems that only the gem tool uses that config.

It would certainly be more consistent for RubyGems to always use .gemrc.  
But if it did, then every program using RubyGems would need to load the  
.gemrc file on startup. That was a bit more overhead[1] than we were  
willing to introduce to unsuspecting programs. Since the only thing the  
average program needs is the gem path, this is simple enough to provide  
via the environment variable. The gem command does allow for more  
configuration options, so it does use a configuration file.

At least that’s how it stands today. Its a judgement call, so I’m  
willing to be convinced otherwise for future versions.

–  
– Jim W.

[1] Not just time overhead, but also conceptual overhead. E.g. reading  
.gemrc requires that YAML be loaded in programs that don’t otherwise  
need it.
