RubyGems - change location from local?

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

Adam W. 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

Jörg W Mittag wrote:

Adam W. 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

Eric H. wrote:

On Aug 28, 2009, at 05:08, Adam W. 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 (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…

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.

On Aug 28, 2009, at 05:08, Adam W. 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 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

Adam W. 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…)

Eric H. wrote:

On Aug 29, 2009, at 11:35, Adam W. 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 :slight_smile:

On Aug 29, 2009, at 11:35, Adam W. 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.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs