# RubyGems - change location from local?

**URL:** <https://rubytalk.org/t/rubygems-change-location-from-local/55122>\
**Category:** ruby-talk\
**Created:** [28 August 2009 12:08 UTC](https://rubytalk.org/t/rubygems-change-location-from-local/55122 "2009-08-28T12:08:11Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Adam\_Wilson](https://avatars.discourse-cdn.com/v4/letter/a/df705f/32.png) [@Adam\_Wilson](https://rubytalk.org/u/Adam_Wilson)\
**Post date:** [28 August 2009 12:08 UTC](https://rubytalk.org/t/rubygems-change-location-from-local/55122/1 "2009-08-28T12:08:11Z")

</div>

I am having a problem on my server with gems..

it manifested as it was giving me an error when starting mongrel:

RubyGem version error: rack(0.3.0 not ~\> 1.0.0)

I installed and checked using gem list, and it seems to be only showing  
those gems installed since I recently upgraded RubyGems.  
So, using locate I saw that 0.3.0 is install in /usr/lib and 1.0.0 is  
installed in /usr/local/lib .. and I cannot properly uninstall 0.3.0, I  
tried deleting the files but I still get the error above. Not wanting to  
mess up the gems on my server I am asking here for advice.

Ideally, I would switch RubyGems to use usr/lib as most of my gems are  
installed there. I could not find it in the docs, any tips much  
appreciated.

Thanks

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

---

<div class="post-metadata">

**Author:** ![Jorg\_W\_Mittag2](https://avatars.discourse-cdn.com/v4/letter/j/e79b87/32.png) [@Jorg\_W\_Mittag2](https://rubytalk.org/u/Jorg_W_Mittag2)\
**Post date:** [28 August 2009 15:45 UTC](https://rubytalk.org/t/rubygems-change-location-from-local/55122/2 "2009-08-28T15:45:09Z")

</div>

Adam Wilson wrote:  
[...]

> I installed and checked using gem list, and it seems to be only showing  
> those gems installed since I recently upgraded RubyGems.

[...]

> Ideally, I would switch RubyGems to use usr/lib as most of my gems are  
> installed there. I could not find it in the docs, any tips much  
> appreciated.

The environment variable GEM\_HOME contains a single directory, which  
tells RubyGems where to install new gems and the environment variable  
GEM\_PATH contains a list of paths where RubyGems looks for gems.

So, in your case you would probably want to set GEM\_HOME to /usr/lib,  
so that all your newly installed gems end up there, and you would set  
GEM\_PATH to /usr/lib:/usr/local/lib (not sure about the syntax, is  
that colon or semicolon?) so that it finds both.

Alternatively you could set GEM\_HOME to /usr/local/lib, gem uninstall  
everything, then set to /usr/lib and reinstall. That way you get rid  
of the old "ghost" gems there. (Note: there are probably a million  
better ways to do this. I know that the RubyGems developers read all  
RubyGems related messages, so they'll surely correct me if I'm wrong.)

jwm

---

<div class="post-metadata">

**Author:** ![Eric\_Hodel1](https://avatars.discourse-cdn.com/v4/letter/e/a9adbd/32.png) [@Eric\_Hodel1](https://rubytalk.org/u/Eric_Hodel1)\
**Post date:** [28 August 2009 17:46 UTC](https://rubytalk.org/t/rubygems-change-location-from-local/55122/3 "2009-08-28T17:46:12Z")

</div>

You have two ruby installs. Fix your $PATH to use the ruby and gem executables from /usr/lib.

`gem env` can help you.

> **···**
>
> On Aug 28, 2009, at 05:08, Adam Wilson wrote:
> 
> > I am having a problem on my server with gems..
> > 
> > it manifested as it was giving me an error when starting mongrel:
> > 
> > RubyGem version error: rack(0.3.0 not ~\> 1.0.0)
> > 
> > I installed and checked using gem list, and it seems to be only showing  
> > those gems installed since I recently upgraded RubyGems.  
> > So, using locate I saw that 0.3.0 is install in /usr/lib and 1.0.0 is  
> > installed in /usr/local/lib .. and I cannot properly uninstall 0.3.0, I  
> > tried deleting the files but I still get the error above. Not wanting to  
> > mess up the gems on my server I am asking here for advice.
> > 
> > Ideally, I would switch RubyGems to use usr/lib as most of my gems are  
> > installed there. I could not find it in the docs, any tips much  
> > appreciated.

---

<div class="post-metadata">

**Author:** ![Adam\_Wilson](https://avatars.discourse-cdn.com/v4/letter/a/df705f/32.png) [@Adam\_Wilson](https://rubytalk.org/u/Adam_Wilson)\
**Post date:** [28 August 2009 16:23 UTC](https://rubytalk.org/t/rubygems-change-location-from-local/55122/4 "2009-08-28T16:23:43Z")

</div>

Jörg W Mittag wrote:

> Adam Wilson wrote:  
> [...]
> 
> > I installed and checked using gem list, and it seems to be only showing  
> > those gems installed since I recently upgraded RubyGems.
> 
> [...]
> 
> > Ideally, I would switch RubyGems to use usr/lib as most of my gems are  
> > installed there. I could not find it in the docs, any tips much  
> > appreciated.
> 
> The environment variable GEM\_HOME contains a single directory, which  
> tells RubyGems where to install new gems and the environment variable  
> GEM\_PATH contains a list of paths where RubyGems looks for gems.
> 
> So, in your case you would probably want to set GEM\_HOME to /usr/lib,  
> so that all your newly installed gems end up there, and you would set  
> GEM\_PATH to /usr/lib:/usr/local/lib (not sure about the syntax, is  
> that colon or semicolon?) so that it finds both.
> 
> Alternatively you could set GEM\_HOME to /usr/local/lib, gem uninstall  
> everything, then set to /usr/lib and reinstall. That way you get rid  
> of the old "ghost" gems there. (Note: there are probably a million  
> better ways to do this. I know that the RubyGems developers read all  
> RubyGems related messages, so they'll surely correct me if I'm wrong.)
> 
> jwm

Many thanks for the info, I will look into it... I will wait till  
tomorrow se if any of the RubyGems experts have anything to say, but  
that info seems enough at least to help me move forward.

Best,  
Adam

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

---

<div class="post-metadata">

**Author:** ![Adam\_Wilson](https://avatars.discourse-cdn.com/v4/letter/a/df705f/32.png) [@Adam\_Wilson](https://rubytalk.org/u/Adam_Wilson)\
**Post date:** [29 August 2009 12:48 UTC](https://rubytalk.org/t/rubygems-change-location-from-local/55122/5 "2009-08-29T12:48:19Z")

</div>

Eric Hodel wrote:

> > installed in /usr/local/lib .. and I cannot properly uninstall  
> > 0.3.0, I  
> > tried deleting the files but I still get the error above. Not  
> > wanting to  
> > mess up the gems on my server I am asking here for advice.
> > 
> > Ideally, I would switch RubyGems to use usr/lib as most of my gems are  
> > installed there. I could not find it in the docs, any tips much  
> > appreciated.
> 
> You have two ruby installs. Fix your $PATH to use the ruby and gem  
> executables from /usr/lib.
> 
> `gem env` can help you.

Ok, thanks, I did in fact have two Ruby installs... I put /usr/lib at  
the front of my path, and that seemed to switch everything to the other  
install - which I realised was 1.8.5, I then proceeded to update that  
version using the procedure outlined here:  
[http://snippets.dzone.com/posts/show/5899](http://snippets.dzone.com/posts/show/5899) (changing --prefix=/usr/local  
to --prefix=/usr) which seemed to work great.

I then proceeded to update my RubyGems again... using gem install  
rubygems-update followed by update\_rubygems.... but now it seems to have  
gone back to an old install of 0.9.0, with no gems listed !!? erk..

> **···**
>
> > On Aug 28, 2009, at 05:08, Adam Wilson wrote:
> 
> --  
> Posted via [http://www.ruby-forum.com/\](http://www.ruby-forum.com/%5C).

---

<div class="post-metadata">

**Author:** ![Adam\_Wilson](https://avatars.discourse-cdn.com/v4/letter/a/df705f/32.png) [@Adam\_Wilson](https://rubytalk.org/u/Adam_Wilson)\
**Post date:** [29 August 2009 13:00 UTC](https://rubytalk.org/t/rubygems-change-location-from-local/55122/6 "2009-08-29T13:00:31Z")

</div>

OK Now I see where the problem came from.. I managed to update RubyGems  
again, and now I am back to where I started: gem env shows all ruby  
paths at /usr/local/bin .. and my $PATH still has /usr/bin as the first  
part. This is confusing me now! Is there a way of running the RubyGems  
update specifying the path??

Thanks for any help.  
Adam.

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

---

<div class="post-metadata">

**Author:** ![Adam\_Wilson](https://avatars.discourse-cdn.com/v4/letter/a/df705f/32.png) [@Adam\_Wilson](https://rubytalk.org/u/Adam_Wilson)\
**Post date:** [29 August 2009 13:02 UTC](https://rubytalk.org/t/rubygems-change-location-from-local/55122/7 "2009-08-29T13:02:19Z")

</div>

Adam Wilson wrote:

> OK Now I see where the problem came from.. I managed to update RubyGems  
> again, and now I am back to where I started: gem env shows all ruby  
> paths at /usr/local/bin .. and my $PATH still has /usr/bin as the first  
> part. This is confusing me now! Is there a way of running the RubyGems  
> update specifying the path??
> 
> Thanks for any help.  
> Adam.

I also just tried running mongrel\_rails ... and I now get this error:

/usr/lib/ruby/1.8/thread.rb:5:in `require': no such file to load --  
thread.so (LoadError)

Any help to get me out of this mess much appreciated!

(I think it all started when I was haphazardly trying to upgrade my ruby  
in order to run the latest version of Typo for a client, who ended up  
not wanted to use it anyway...)

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

---

<div class="post-metadata">

**Author:** ![Adam\_Wilson](https://avatars.discourse-cdn.com/v4/letter/a/df705f/32.png) [@Adam\_Wilson](https://rubytalk.org/u/Adam_Wilson)\
**Post date:** [29 August 2009 18:35 UTC](https://rubytalk.org/t/rubygems-change-location-from-local/55122/8 "2009-08-29T18:35:46Z")

</div>

OK sorted that problem (copied the file to /usr/bin/ruby/1.8)

If anyone can help with updating RubyGems but so it uses /usr/bin  
instead of /usr/local/bin, that would be much appreciated.

Thank you  
Adam

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

---

<div class="post-metadata">

**Author:** ![Eric\_Hodel1](https://avatars.discourse-cdn.com/v4/letter/e/a9adbd/32.png) [@Eric\_Hodel1](https://rubytalk.org/u/Eric_Hodel1)\
**Post date:** [31 August 2009 23:08 UTC](https://rubytalk.org/t/rubygems-change-location-from-local/55122/9 "2009-08-31T23:08:51Z")

</div>

> OK sorted that problem (copied the file to /usr/bin/ruby/1.8)

This is probably going to cause a segfault or similar weirdness in the future. NEVER DO THIS.

> If anyone can help with updating RubyGems but so it uses /usr/bin  
> instead of /usr/local/bin, that would be much appreciated.

Uninstall both ruby versions and reinstall from scratch.

> **···**
>
> On Aug 29, 2009, at 11:35, Adam Wilson wrote:

---

<div class="post-metadata">

**Author:** ![Adam\_Wilson](https://avatars.discourse-cdn.com/v4/letter/a/df705f/32.png) [@Adam\_Wilson](https://rubytalk.org/u/Adam_Wilson)\
**Post date:** [31 August 2009 23:47 UTC](https://rubytalk.org/t/rubygems-change-location-from-local/55122/10 "2009-08-31T23:47:02Z")

</div>

Eric Hodel wrote:

> **···**
>
> > On Aug 29, 2009, at 11:35, Adam Wilson wrote:
> > 
> > > OK sorted that problem (copied the file to /usr/bin/ruby/1.8)
> > 
> > This is probably going to cause a segfault or similar weirdness in the  
> > future. NEVER DO THIS.
> > 
> > > If anyone can help with updating RubyGems but so it uses /usr/bin  
> > > instead of /usr/local/bin, that would be much appreciated.
> > 
> > Uninstall both ruby versions and reinstall from scratch.
> 
> OK thanks for the advice... I managed to sort the prob by reinstalling  
> RubyGems from source specifying /usr/bin/ruby/1.8 as the installation  
> path and specifiying prefix=/usr .. then ran rubyems\_update and it seems  
> too be working now 🙂  
> --  
> Posted via [http://www.ruby-forum.com/\](http://www.ruby-forum.com/%5C).
