RubyGems - change location from local?

A

Adam Wilson

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
 
J

Jörg W Mittag

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
 
A

Adam Wilson

Jörg W Mittag said:
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
 
E

Eric Hodel

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.

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

`gem env` can help you.
 
A

Adam Wilson

Eric said:
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..
 
A

Adam Wilson

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.
 
A

Adam Wilson

Adam said:
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...)
 
A

Adam Wilson

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
 
E

Eric Hodel

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.
 
A

Adam Wilson

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


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 :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top