RubyGems - change location from local?

Discussion in 'Ruby' started by Adam Wilson, Aug 28, 2009.

  1. Adam Wilson

    Adam Wilson Guest

    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/.
    Adam Wilson, Aug 28, 2009
    #1
    1. Advertising

  2. 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
    Jörg W Mittag, Aug 28, 2009
    #2
    1. Advertising

  3. Adam Wilson

    Adam Wilson Guest

    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/.
    Adam Wilson, Aug 28, 2009
    #3
  4. Adam Wilson

    Eric Hodel Guest

    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.


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

    `gem env` can help you.
    Eric Hodel, Aug 28, 2009
    #4
  5. Adam Wilson

    Adam Wilson Guest

    Eric Hodel wrote:
    > On Aug 28, 2009, at 05:08, Adam Wilson 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..
    --
    Posted via http://www.ruby-forum.com/.
    Adam Wilson, Aug 29, 2009
    #5
  6. Adam Wilson

    Adam Wilson Guest

    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/.
    Adam Wilson, Aug 29, 2009
    #6
  7. Adam Wilson

    Adam Wilson Guest

    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/.
    Adam Wilson, Aug 29, 2009
    #7
  8. Adam Wilson

    Adam Wilson Guest

    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/.
    Adam Wilson, Aug 29, 2009
    #8
  9. Adam Wilson

    Eric Hodel Guest

    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.
    Eric Hodel, Sep 1, 2009
    #9
  10. Adam Wilson

    Adam Wilson Guest

    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/.
    Adam Wilson, Sep 1, 2009
    #10
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Trevor
    Replies:
    5
    Views:
    571
    Bill Kelly
    Jan 29, 2005
  2. Erik Veenstra
    Replies:
    4
    Views:
    811
    Austin Ziegler
    Feb 4, 2005
  3. Mike Ferrier

    rubygems local install?

    Mike Ferrier, Sep 20, 2006, in forum: Ruby
    Replies:
    2
    Views:
    137
    Mike Ferrier
    Sep 20, 2006
  4. Nasir Khan

    [OOT] rubygems: location of my gems

    Nasir Khan, Jan 4, 2008, in forum: Ruby
    Replies:
    5
    Views:
    123
    Nasir Khan
    Jan 4, 2008
  5. Eric Roscher
    Replies:
    3
    Views:
    363
    Eric Roscher
    Nov 24, 2009
Loading...

Share This Page