# Difficulty updating Ruby Gems in a non-standard location

**URL:** <https://www.ruby-forum.com/t/difficulty-updating-ruby-gems-in-a-non-standard-location/176949>\
**Category:** Ruby\
**Created:** [October 8, 2009, 7:54pm UTC](https://www.ruby-forum.com/t/difficulty-updating-ruby-gems-in-a-non-standard-location/176949 "2009-10-08T19:54:55Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![David\_Brodbeck](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/b5a626/32.png) [@David\_Brodbeck](https://www.ruby-forum.com/u/David_Brodbeck)\
**Post date:** [October 8, 2009, 7:54pm UTC](https://www.ruby-forum.com/t/difficulty-updating-ruby-gems-in-a-non-standard-location/176949/1 "2009-10-08T19:54:55Z")

</div>

I have Ruby Gems installed in a non-standard location. Both  
$GEM\_PREFIX and $GEM\_HOME are set. I’m attempting to update from  
0.9.4 to 1.3.5, without success.

First attempt: I tried “gem update --system”. This didn’t work  
because it ignored $GEM\_PREFIX and installed in the wrong location.

Second attempt: I tried the instructions here:  
[http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/243916](http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/243916)  
This completely broke gem; every time I tried to do something with  
it I got this error:  
/opt/ruby-gems/bin/gem:14: undefined method `ruby\_version’ for  
Gem:Module (NoMethodError)

Third attempt: I restored my gem directory from backup and tried “gem  
install rubygems-update && update\_rubygems”. This gave the following  
error:  
Error: Cannot find RubyGems Update Path!

```
RubyGems has already been updated.
The rubygems-update gem may now be uninstalled.
E.g. gem uninstall rubygems-update

```

So, now I’m stumped. How do I update Ruby Gems if it’s not installed  
in the standard location?

–

David Brodbeck  
System A., Linguistics  
University of Washington

---

<div class="post-metadata">

**Author:** ![David\_Brodbeck](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/b5a626/32.png) [@David\_Brodbeck](https://www.ruby-forum.com/u/David_Brodbeck)\
**Post date:** [October 8, 2009, 8:31pm UTC](https://www.ruby-forum.com/t/difficulty-updating-ruby-gems-in-a-non-standard-location/176949/2 "2009-10-08T20:31:48Z")

</div>

On Oct 8, 2009, at 10:53 AM, David Brodbeck wrote:

> /opt/ruby-gems/bin/gem:14: undefined method `ruby\_version’ for
> 
> So, now I’m stumped. How do I update Ruby Gems if it’s not  
> installed in the standard location?

I would suggest downloading the tar.gz and running setup.rb (making  
sure GEM\_PREFIX and GEM\_HOME are set). That might clear up your  
problems.

You can grab the tar.gz file here:

```
 http://rubyforge.org/frs/?group_id=126

```

* * *

Aaron P.  
[http://tenderlovemaking.com](http://tenderlovemaking.com)

---

<div class="post-metadata">

**Author:** ![David\_Brodbeck](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/b5a626/32.png) [@David\_Brodbeck](https://www.ruby-forum.com/u/David_Brodbeck)\
**Post date:** [October 8, 2009, 10:52pm UTC](https://www.ruby-forum.com/t/difficulty-updating-ruby-gems-in-a-non-standard-location/176949/3 "2009-10-08T22:52:21Z")

</div>

On Oct 8, 2009, at 11:28 AM, Aaron P. wrote:

> > This completely broke gem; every time I tried to do something with  
> > The rubygems-update gem may now be uninstalled.
> 
> [http://rubyforge.org/frs/?group\_id=126](http://rubyforge.org/frs/?group_id=126)

Unfortunately, that failed in the same way “gem update --system” did  
– it ignored $GEM\_PREFIX and tried to install gem under /usr/bin/  
gem. The gem installation in /opt/ruby-gems was left untouched.

–

David Brodbeck  
System A., Linguistics  
University of Washington

---

<div class="post-metadata">

**Author:** ![David\_Brodbeck](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/b5a626/32.png) [@David\_Brodbeck](https://www.ruby-forum.com/u/David_Brodbeck)\
**Post date:** [October 10, 2009, 12:18am UTC](https://www.ruby-forum.com/t/difficulty-updating-ruby-gems-in-a-non-standard-location/176949/4 "2009-10-10T00:18:26Z")

</div>

On Oct 8, 2009, at 3:39 PM, David Brodbeck wrote:

> > ruby setup.rb --prefix=/opt/ruby-gems
> 
> That went to the right place, but now gem is broken:
> 
> $ gem  
> /opt/ruby-gems/bin/gem:14: undefined method `ruby\_version’ for  
> Gem:Module (NoMethodError)

I finally figured it out. I had two copies under ruby-gems, a new one  
in /opt/ruby-gems/lib and an old one in /opt/ruby-gems/lib/site\_ruby/  
1.8. I deleted the latter and it seems to be working now.

Thanks to everyone for their help.

–

David Brodbeck  
System A., Linguistics  
University of Washington

---

<div class="post-metadata">

**Author:** ![David\_Brodbeck](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/b5a626/32.png) [@David\_Brodbeck](https://www.ruby-forum.com/u/David_Brodbeck)\
**Post date:** [October 8, 2009, 11:44pm UTC](https://www.ruby-forum.com/t/difficulty-updating-ruby-gems-in-a-non-standard-location/176949/5 "2009-10-08T23:44:27Z")

</div>

On Thursday 08 October 2009 01:51:33 pm David Brodbeck wrote:

> > > [http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/243916](http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/243916) This  
> > > RubyGems has already been updated.  
> > > You can grab the tar.gz file here:
> > 
> > [http://rubyforge.org/frs/?group\_id=126](http://rubyforge.org/frs/?group_id=126)
> 
> Unfortunately, that failed in the same way “gem update --system” did  
> – it ignored $GEM\_PREFIX and tried to install gem under /usr/bin/  
> gem. The gem installation in /opt/ruby-gems was left untouched.

Using the source you downloaded, make sure that GEM\_HOME is exported,  
then run  
setup with the prefix to the install location:

ruby setup.rb --prefix=/opt/ruby-gems

- spox

---

<div class="post-metadata">

**Author:** ![David\_Brodbeck](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/b5a626/32.png) [@David\_Brodbeck](https://www.ruby-forum.com/u/David_Brodbeck)\
**Post date:** [October 9, 2009, 12:42am UTC](https://www.ruby-forum.com/t/difficulty-updating-ruby-gems-in-a-non-standard-location/176949/6 "2009-10-09T00:42:59Z")

</div>

On Oct 8, 2009, at 2:43 PM, spox wrote:

> > Unfortunately, that failed in the same way “gem update --system” did  
> > – it ignored $GEM\_PREFIX and tried to install gem under /usr/bin/  
> > gem. The gem installation in /opt/ruby-gems was left untouched.
> 
> Using the source you downloaded, make sure that GEM\_HOME is  
> exported, then run  
> setup with the prefix to the install location:
> 
> ruby setup.rb --prefix=/opt/ruby-gems

That went to the right place, but now gem is broken:

$ gem  
/opt/ruby-gems/bin/gem:14: undefined method `ruby\_version’ for  
Gem:Module (NoMethodError)

–

David Brodbeck  
System A., Linguistics  
University of Washington
