# Home of the gems?

**URL:** <https://rubytalk.org/t/home-of-the-gems/23142>\
**Category:** ruby-talk\
**Created:** [9 December 2005 02:11 UTC](https://rubytalk.org/t/home-of-the-gems/23142 "2005-12-09T02:11:40Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kelly\_Dwight\_Felkins](https://avatars.discourse-cdn.com/v4/letter/k/ecccb3/32.png) [@Kelly\_Dwight\_Felkins](https://rubytalk.org/u/Kelly_Dwight_Felkins)\
**Post date:** [9 December 2005 02:11 UTC](https://rubytalk.org/t/home-of-the-gems/23142/1 "2005-12-09T02:11:40Z")

</div>

I'm trying to understand how gems are loaded. Please help.

A little background:

I decided to do some rails development work on a debian system. I didn't  
think rails was up to date, so I tried to do a 'gem update rails'. This  
failed because I did not have root access. So I installed the gems locally.  
Everthing seemed fine.

I later deleted the local gem directory. Now:

&nbsp;&nbsp;&nbsp;- "gem list" says there are no gems.  
&nbsp;&nbsp;&nbsp;- "gemwhich rails" says "can't find rails.  
&nbsp;&nbsp;&nbsp;- The application runs fine.

By now it is clear to me that there are gems installed in the default  
location. I would like to override this with a local install. I don't  
understand how the load path is determined.

Thanks for your help.

-Kelly

---

<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:** [9 December 2005 04:52 UTC](https://rubytalk.org/t/home-of-the-gems/23142/2 "2005-12-09T04:52:26Z")

</div>

railsinator wrote:

> I'm trying to understand how gems are loaded. Please help.
> 
> A little background:
> 
> I decided to do some rails development work on a debian system. I didn't  
> think rails was up to date, so I tried to do a 'gem update rails'. This  
> failed because I did not have root access. So I installed the gems  
> locally.  
> Everthing seemed fine.
> 
> I later deleted the local gem directory. Now:
> 
> &nbsp;&nbsp;&nbsp;- "gem list" says there are no gems.  
> &nbsp;&nbsp;&nbsp;- "gemwhich rails" says "can't find rails.  
> &nbsp;&nbsp;&nbsp;- The application runs fine.
> 
> By now it is clear to me that there are gems installed in the default  
> location. I would like to override this with a local install. I don't  
> understand how the load path is determined.
> 
> Thanks for your help.

'gem env' will give you some information about your gem environment.  
You can control the details here via environment variables:

&nbsp;&nbsp;&nbsp;GEM\_HOME -- Path to gem repository where gems are installed by  
default.  
&nbsp;&nbsp;&nbsp;GEM\_PATH -- List of paths of gem repositories to be searched.

-- Jim Weirich

> **···**
>
> --  
> Posted via [http://www.ruby-forum.com/\](http://www.ruby-forum.com/%5C).

---

<div class="post-metadata">

**Author:** ![Kelly\_Dwight\_Felkins](https://avatars.discourse-cdn.com/v4/letter/k/ecccb3/32.png) [@Kelly\_Dwight\_Felkins](https://rubytalk.org/u/Kelly_Dwight_Felkins)\
**Post date:** [9 December 2005 18:03 UTC](https://rubytalk.org/t/home-of-the-gems/23142/3 "2005-12-09T18:03:33Z")

</div>

Thanks for getting back to me Jim. Please bear with me as I try to  
understand how this works.

If I do "gem env" I get a stack trace:

kfelkins@lurch:~/bin$ gem env  
/usr/local/lib/site\_ruby/1.8/rubygems.rb:194:in `report\_activate\_error':  
Could not find RubyGem sources (\> 0.0.0) (Gem::LoadError)  
&nbsp;&nbsp;&nbsp;&nbsp;from /usr/local/lib/site\_ruby/1.8/rubygems.rb:136:in `activate'  
&nbsp;&nbsp;&nbsp;&nbsp;from /usr/local/lib/site\_ruby/1.8/rubygems.rb:37:in  
`require\_gem\_with\_options'  
&nbsp;&nbsp;&nbsp;&nbsp;from /usr/local/lib/site\_ruby/1.8/rubygems.rb:31:in `require\_gem'  
&nbsp;&nbsp;&nbsp;&nbsp;from /usr/local/lib/site\_ruby/1.8/rubygems/remote\_installer.rb:403:in  
`sources'  
&nbsp;&nbsp;&nbsp;&nbsp;from /usr/local/lib/site\_ruby/1.8/rubygems/gem\_commands.rb:897:in  
`execute'  
&nbsp;&nbsp;&nbsp;&nbsp;from /usr/local/lib/site\_ruby/1.8/rubygems/command.rb:49:in `invoke'  
&nbsp;&nbsp;&nbsp;&nbsp;from /usr/local/lib/site\_ruby/1.8/rubygems/cmd\_manager.rb:92:in  
`process\_args'  
&nbsp;&nbsp;&nbsp;&nbsp;from /usr/local/lib/site\_ruby/1.8/rubygems/cmd\_manager.rb:65:in `run'  
&nbsp;&nbsp;&nbsp;&nbsp;from /usr/local/lib/site\_ruby/1.8/rubygems/gem\_runner.rb:9:in `run'  
&nbsp;&nbsp;&nbsp;&nbsp;from /home/kfelkins/bin/gem:17  
kfelkins@lurch:~/bin$

Still, my rails app will run when I start it with script/server.

So clearly there are a set of gems installed somewhere. These were likely  
installed via the debian package management system. So how are gems found?

kfelkins@lurch:~/bin$ echo $GEM\_HOME  
/home/kfelkins/gem-repository  
kfelkins@lurch:~/bin$ ls -l $GEM\_HOME  
total 16  
drwxrwxr-x 2 kfelkins genome 4096 2005-12-08 17:15 cache  
drwxrwxr-x 2 kfelkins genome 4096 2005-12-08 17:15 doc  
drwxrwxr-x 2 kfelkins genome 4096 2005-12-08 17:15 gems  
drwxrwxr-x 2 kfelkins genome 4096 2005-12-08 17:15 specifications  
kfelkins@lurch:~/bin$ cd $GEM\_HOME/gems  
kfelkins@lurch:~/gem-repository/gems$ ls  
kfelkins@lurch:~/gem-repository/gems$ echo $GEM\_PATH  
kfelkins@lurch:~/gem-repository/gems$

Thanks again.

-Kelly

> **···**
>
> On 12/8/05, Jim Weirich \<jim@weirichhouse.org\> wrote:
> 
> > railsinator wrote:  
> > \> I'm trying to understand how gems are loaded. Please help.  
> > \>  
> > \> A little background:  
> > \>  
> > \> I decided to do some rails development work on a debian system. I didn't  
> > \> think rails was up to date, so I tried to do a 'gem update rails'. This  
> > \> failed because I did not have root access. So I installed the gems  
> > \> locally.  
> > \> Everthing seemed fine.  
> > \>  
> > \> I later deleted the local gem directory. Now:  
> > \>  
> > \> - "gem list" says there are no gems.  
> > \> - "gemwhich rails" says "can't find rails.  
> > \> - The application runs fine.  
> > \>  
> > \> By now it is clear to me that there are gems installed in the default  
> > \> location. I would like to override this with a local install. I don't  
> > \> understand how the load path is determined.  
> > \>  
> > \> Thanks for your help.
> > 
> > 'gem env' will give you some information about your gem environment.  
> > You can control the details here via environment variables:
> > 
> > &nbsp;&nbsp;&nbsp;GEM\_HOME -- Path to gem repository where gems are installed by  
> > default.  
> > &nbsp;&nbsp;&nbsp;GEM\_PATH -- List of paths of gem repositories to be searched.
> > 
> > -- Jim Weirich
> > 
> > --  
> > Posted via [http://www.ruby-forum.com/\](http://www.ruby-forum.com/%5C).

---

<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:** [9 December 2005 18:53 UTC](https://rubytalk.org/t/home-of-the-gems/23142/4 "2005-12-09T18:53:13Z")

</div>

railsinator wrote:

> Thanks for getting back to me Jim. Please bear with me as I try to  
> understand how this works.
> 
> If I do "gem env" I get a stack trace:
> 
> kfelkins@lurch:~/bin$ gem env  
> /usr/local/lib/site\_ruby/1.8/rubygems.rb:194:in `report\_activate\_error':  
> Could not find RubyGem sources (\> 0.0.0) (Gem::LoadError)  
> &nbsp;&nbsp;&nbsp;&nbsp;from /usr/local/lib/site\_ruby/1.8/rubygems.rb:136:in `activate'  
> &nbsp;&nbsp;&nbsp;&nbsp;from /usr/local/lib/site\_ruby/1.8/rubygems.rb:37:in  
> `require\_gem\_with\_options'  
> &nbsp;&nbsp;&nbsp;&nbsp;from /usr/local/lib/site\_ruby/1.8/rubygems.rb:31:in `require\_gem'  
> &nbsp;&nbsp;&nbsp;&nbsp;from  
> /usr/local/lib/site\_ruby/1.8/rubygems/remote\_installer.rb:403:in  
> `sources'  
> &nbsp;&nbsp;&nbsp;&nbsp;from /usr/local/lib/site\_ruby/1.8/rubygems/gem\_commands.rb:897:in  
> `execute'  
> &nbsp;&nbsp;&nbsp;&nbsp;from /usr/local/lib/site\_ruby/1.8/rubygems/command.rb:49:in `invoke'  
> &nbsp;&nbsp;&nbsp;&nbsp;from /usr/local/lib/site\_ruby/1.8/rubygems/cmd\_manager.rb:92:in  
> `process\_args'  
> &nbsp;&nbsp;&nbsp;&nbsp;from /usr/local/lib/site\_ruby/1.8/rubygems/cmd\_manager.rb:65:in  
> `run'  
> &nbsp;&nbsp;&nbsp;&nbsp;from /usr/local/lib/site\_ruby/1.8/rubygems/gem\_runner.rb:9:in `run'  
> &nbsp;&nbsp;&nbsp;&nbsp;from /home/kfelkins/bin/gem:17  
> kfelkins@lurch:~/bin$
> 
> Still, my rails app will run when I start it with script/server.
> 
> So clearly there are a set of gems installed somewhere. These were  
> likely  
> installed via the debian package management system. So how are gems  
> found?
> 
> kfelkins@lurch:~/bin$ echo $GEM\_HOME  
> /home/kfelkins/gem-repository  
> kfelkins@lurch:~/bin$ ls -l $GEM\_HOME  
> total 16  
> drwxrwxr-x 2 kfelkins genome 4096 2005-12-08 17:15 cache  
> drwxrwxr-x 2 kfelkins genome 4096 2005-12-08 17:15 doc  
> drwxrwxr-x 2 kfelkins genome 4096 2005-12-08 17:15 gems  
> drwxrwxr-x 2 kfelkins genome 4096 2005-12-08 17:15 specifications  
> kfelkins@lurch:~/bin$ cd $GEM\_HOME/gems  
> kfelkins@lurch:~/gem-repository/gems$ ls  
> kfelkins@lurch:~/gem-repository/gems$ echo $GEM\_PATH  
> kfelkins@lurch:~/gem-repository/gems$

Ok, it looks like you no longer have the system gem repository in your  
GEM\_PATH. Gem can't find its sources gem.

Try adding the original repository to the GEM\_PATH. Perhaps something  
like this:

&nbsp;&nbsp;&nbsp;export GEM\_PATH=/usr/local/lib/ruby/gems/1.8

(you might need to tweek the directory for your local system).

Once you add that line, gems should search both your $GEM\_HOME  
repository and the GEM\_PATH repository. You can add more repositories  
to GEM\_PATH if you wish.

-- Jim Weirich

> **···**
>
> --  
> Posted via [http://www.ruby-forum.com/\](http://www.ruby-forum.com/%5C).

---

<div class="post-metadata">

**Author:** ![Kelly\_Dwight\_Felkins](https://avatars.discourse-cdn.com/v4/letter/k/ecccb3/32.png) [@Kelly\_Dwight\_Felkins](https://rubytalk.org/u/Kelly_Dwight_Felkins)\
**Post date:** [9 December 2005 19:02 UTC](https://rubytalk.org/t/home-of-the-gems/23142/5 "2005-12-09T19:02:52Z")

</div>

I think rails can find the gems. Do you know how rails does it?

I'm not certain that rails uses gems \*after\* an application has been  
created. Rails is installed as a collection of gems, but I guess it is  
possible that when you create a rails application all of the required  
libraries are copied or linked, though I doubt it.

-kelly

> **···**
>
> On 12/9/05, Jim Weirich \<jim@weirichhouse.org\> wrote:
> 
> > railsinator wrote:  
> > \> Thanks for getting back to me Jim. Please bear with me as I try to  
> > \> understand how this works.  
> > \>  
> > \> If I do "gem env" I get a stack trace:  
> > \>  
> > \> kfelkins@lurch:~/bin$ gem env  
> > \> /usr/local/lib/site\_ruby/1.8/rubygems.rb:194:in `report\_activate\_error':  
> > \> Could not find RubyGem sources (\> 0.0.0) (Gem::LoadError)  
> > \> from /usr/local/lib/site\_ruby/1.8/rubygems.rb:136:in `activate'  
> > \> from /usr/local/lib/site\_ruby/1.8/rubygems.rb:37:in  
> > \> `require\_gem\_with\_options'  
> > \> from /usr/local/lib/site\_ruby/1.8/rubygems.rb:31:in `require\_gem'  
> > \> from  
> > \> /usr/local/lib/site\_ruby/1.8/rubygems/remote\_installer.rb:403:in  
> > \> `sources'  
> > \> from /usr/local/lib/site\_ruby/1.8/rubygems/gem\_commands.rb:897:in  
> > \> `execute'  
> > \> from /usr/local/lib/site\_ruby/1.8/rubygems/command.rb:49:in `invoke'  
> > \> from /usr/local/lib/site\_ruby/1.8/rubygems/cmd\_manager.rb:92:in  
> > \> `process\_args'  
> > \> from /usr/local/lib/site\_ruby/1.8/rubygems/cmd\_manager.rb:65:in  
> > \> `run'  
> > \> from /usr/local/lib/site\_ruby/1.8/rubygems/gem\_runner.rb:9:in `run'  
> > \> from /home/kfelkins/bin/gem:17  
> > \> kfelkins@lurch:~/bin$  
> > \>  
> > \> Still, my rails app will run when I start it with script/server.  
> > \>  
> > \> So clearly there are a set of gems installed somewhere. These were  
> > \> likely  
> > \> installed via the debian package management system. So how are gems  
> > \> found?  
> > \>  
> > \> kfelkins@lurch:~/bin$ echo $GEM\_HOME  
> > \> /home/kfelkins/gem-repository  
> > \> kfelkins@lurch:~/bin$ ls -l $GEM\_HOME  
> > \> total 16  
> > \> drwxrwxr-x 2 kfelkins genome 4096 2005-12-08 17:15 cache  
> > \> drwxrwxr-x 2 kfelkins genome 4096 2005-12-08 17:15 doc  
> > \> drwxrwxr-x 2 kfelkins genome 4096 2005-12-08 17:15 gems  
> > \> drwxrwxr-x 2 kfelkins genome 4096 2005-12-08 17:15 specifications  
> > \> kfelkins@lurch:~/bin$ cd $GEM\_HOME/gems  
> > \> kfelkins@lurch:~/gem-repository/gems$ ls  
> > \> kfelkins@lurch:~/gem-repository/gems$ echo $GEM\_PATH  
> > \> kfelkins@lurch:~/gem-repository/gems$
> > 
> > Ok, it looks like you no longer have the system gem repository in your  
> > GEM\_PATH. Gem can't find its sources gem.
> > 
> > Try adding the original repository to the GEM\_PATH. Perhaps something  
> > like this:
> > 
> > &nbsp;&nbsp;&nbsp;export GEM\_PATH=/usr/local/lib/ruby/gems/1.8
> > 
> > (you might need to tweek the directory for your local system).
> > 
> > Once you add that line, gems should search both your $GEM\_HOME  
> > repository and the GEM\_PATH repository. You can add more repositories  
> > to GEM\_PATH if you wish.
> > 
> > -- Jim Weirich
> > 
> > --  
> > Posted via [http://www.ruby-forum.com/\](http://www.ruby-forum.com/%5C).

---

<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:** [9 December 2005 19:50 UTC](https://rubytalk.org/t/home-of-the-gems/23142/6 "2005-12-09T19:50:38Z")

</div>

railsinator wrote:

> I think rails can find the gems. Do you know how rails does it?
> 
> I'm not certain that rails uses gems \*after\* an application has been  
> created. Rails is installed as a collection of gems, but I guess it is  
> possible that when you create a rails application all of the required  
> libraries are copied or linked, though I doubt it.

hard to say without knowing more details. Some possibilities are:

(1) Rails comes in non-gem versions, is one of those installed?  
(2) GEM\_HOME is an environment variable. Although your interactive  
shell was messed up, it could be that rails is running in a different  
window with its own, properly setup, GEM\_HOME value. (Possibly started  
before you changed it).

-- Jim Weirich

> **···**
>
> --  
> Posted via [http://www.ruby-forum.com/\](http://www.ruby-forum.com/%5C).

---

<div class="post-metadata">

**Author:** ![Kelly\_Dwight\_Felkins](https://avatars.discourse-cdn.com/v4/letter/k/ecccb3/32.png) [@Kelly\_Dwight\_Felkins](https://rubytalk.org/u/Kelly_Dwight_Felkins)\
**Post date:** [9 December 2005 20:24 UTC](https://rubytalk.org/t/home-of-the-gems/23142/7 "2005-12-09T20:24:51Z")

</div>

Thanks Jim. I'm going to go with your #1. Since this is a debian system, my  
guess is rails was installed using apt-get. I also run debian on my personal  
systems but I don't use apt-get to install rails -- I use gems.

-Kelly

> **···**
>
> On 12/9/05, Jim Weirich \<jim@weirichhouse.org\> wrote:
> 
> > railsinator wrote:  
> > \> I think rails can find the gems. Do you know how rails does it?  
> > \>  
> > \> I'm not certain that rails uses gems \*after\* an application has been  
> > \> created. Rails is installed as a collection of gems, but I guess it is  
> > \> possible that when you create a rails application all of the required  
> > \> libraries are copied or linked, though I doubt it.
> > 
> > hard to say without knowing more details. Some possibilities are:
> > 
> > (1) Rails comes in non-gem versions, is one of those installed?  
> > (2) GEM\_HOME is an environment variable. Although your interactive  
> > shell was messed up, it could be that rails is running in a different  
> > window with its own, properly setup, GEM\_HOME value. (Possibly started  
> > before you changed it).
> > 
> > -- Jim Weirich
> > 
> > --  
> > Posted via [http://www.ruby-forum.com/\](http://www.ruby-forum.com/%5C).
