# Ruby 1.8.5 on Mac OS X

**URL:** <https://rubytalk.org/t/ruby-1-8-5-on-mac-os-x/33244>\
**Category:** ruby-talk\
**Created:** [27 November 2006 17:25 UTC](https://rubytalk.org/t/ruby-1-8-5-on-mac-os-x/33244 "2006-11-27T17:25:25Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Doug\_Kramer](https://avatars.discourse-cdn.com/v4/letter/d/a183cd/32.png) [@Doug\_Kramer](https://rubytalk.org/u/Doug_Kramer)\
**Post date:** [27 November 2006 17:25 UTC](https://rubytalk.org/t/ruby-1-8-5-on-mac-os-x/33244/1 "2006-11-27T17:25:25Z")

</div>

On Mac OS X 10.4.8, Ruby 1.8.2 is installed in /usr/bin/ruby  
I installed RubyGems and several libraries.

I needed to upgrade to the latest version,  
so I downloaded Ruby 1.8.5 source from:  
[http://www2.ruby-lang.org/en/20020102.html](http://www2.ruby-lang.org/en/20020102.html)  
which I installed in:  
/usr/local/bin/rub  
Now RubyGems and the libraries I had installed are not found.

I can run ruby with this alias:

ruby='/usr/local/bin/ruby'

Is there a way to get RubyGems and the libraries to be  
recognized by this new version? Or a way to install them  
into the new version?

-Doug

---

<div class="post-metadata">

**Author:** ![Pere\_Noel1](https://avatars.discourse-cdn.com/v4/letter/p/d6d6ee/32.png) [@Pere\_Noel1](https://rubytalk.org/u/Pere_Noel1)\
**Post date:** [27 November 2006 17:45 UTC](https://rubytalk.org/t/ruby-1-8-5-on-mac-os-x/33244/2 "2006-11-27T17:45:11Z")

</div>

Yes "no prob" 😉

currently (apart from Apple's buggy ruby) i'm using two rubies install  
one under /opt (MacPort) another one devoted to jRuby under my HOME/bin.

aliasing isn't sufficiant, u have also to setup your PATH such a way the  
kernel hits /usr/local/bin before /usr/bin, afaik.

entering in ther terminal :

which ruby

gives you the "good" one ?

also did you setup in your env vars GEM\_HOME, RUBYOPT and RUBYGEMS ?

another way to specify dirs is to use a ~/.gemrc see the on line man of  
rubygems.

hoping that could help.

> **···**
>
> doog \<doog@google.com\> wrote:
> 
> > so I downloaded Ruby 1.8.5 source from:  
> > [http://www2.ruby-lang.org/en/20020102.html](http://www2.ruby-lang.org/en/20020102.html)  
> > which I installed in:  
> > /usr/local/bin/rub  
> > Now RubyGems and the libraries I had installed are not found.
> > 
> > I can run ruby with this alias:
> > 
> > ruby='/usr/local/bin/ruby'
> > 
> > Is there a way to get RubyGems and the libraries to be  
> > recognized by this new version? Or a way to install them  
> > into the new version?
> 
> --  
> une bévue

---

<div class="post-metadata">

**Author:** ![Chuck\_Remes](https://avatars.discourse-cdn.com/v4/letter/c/3be4f8/32.png) [@Chuck\_Remes](https://rubytalk.org/u/Chuck_Remes)\
**Post date:** [27 November 2006 17:50 UTC](https://rubytalk.org/t/ruby-1-8-5-on-mac-os-x/33244/3 "2006-11-27T17:50:09Z")

</div>

Doug,

you need to add "/usr/local/bin" to your PATH variable. It's apparent from this question that you don't understand some of the basics of OSX's UNIX shell behavior. Here's a link [1] to a set of basic UNIX tutorials which will give you a nice foundation for working in a shell environment going forward.

In the meantime, fire up Terminal.app and do the following:

1. cd $HOME

2. echo 'PATH=/usr/local/bin:$PATH' \>\> .profile

3. echo 'export PATH' \>\> .profile

Make sure you use single quotes instead of double quotes!

Quit Terminal.app and then reopen it. At the shell prompt type 'which ruby' to confirm it returns '/usr/local/bin/ruby' to you.

cr

[1] [http://www.ee.surrey.ac.uk/Teaching/Unix/](http://www.ee.surrey.ac.uk/Teaching/Unix/)

> **···**
>
> On Nov 27, 2006, at 11:25 AM, doog wrote:
> 
> > On Mac OS X 10.4.8, Ruby 1.8.2 is installed in /usr/bin/ruby  
> > I installed RubyGems and several libraries.
> > 
> > I needed to upgrade to the latest version,  
> > so I downloaded Ruby 1.8.5 source from:  
> > [http://www2.ruby-lang.org/en/20020102.html](http://www2.ruby-lang.org/en/20020102.html)  
> > which I installed in:  
> > /usr/local/bin/rub  
> > Now RubyGems and the libraries I had installed are not found.
> > 
> > I can run ruby with this alias:
> > 
> > ruby='/usr/local/bin/ruby'
> > 
> > Is there a way to get RubyGems and the libraries to be  
> > recognized by this new version? Or a way to install them  
> > into the new version?

---

<div class="post-metadata">

**Author:** ![Doug\_Kramer](https://avatars.discourse-cdn.com/v4/letter/d/a183cd/32.png) [@Doug\_Kramer](https://rubytalk.org/u/Doug_Kramer)\
**Post date:** [27 November 2006 20:02 UTC](https://rubytalk.org/t/ruby-1-8-5-on-mac-os-x/33244/4 "2006-11-27T20:02:11Z")

</div>

Thanks for the info about GEM\_HOME. I set up /usr/local/bin  
to be ahead of /usr/bin. I still have trouble getting the gems  
to be loaded with the newer /usr/local/bin/ruby

Here's my setup now:  
/usr/local/bin/ruby # latest ruby  
/usr/lib/ruby/gems/1.8/gems/ # gems

Do I set:  
GEM\_HOME=/usr/lib/ruby/gems  
or  
GEM\_HOME=/usr/lib/ruby/gems/1.8/gems

Also, it's not clear to what values to use for "user directory"  
and the "mygemrepository" in the following (taken from the RubyGems  
man page: [http://rubygems.org/read/chapter/3](http://rubygems.org/read/chapter/3))

&nbsp;&nbsp;&nbsp;&nbsp;Use the following to install RubyGems in a user directory  
&nbsp;&nbsp;&nbsp;&nbsp;(here called /home/mystuff)  
&nbsp;&nbsp;&nbsp;&nbsp;with a repository named /home/mygemrepository):

&nbsp;&nbsp;&nbsp;&nbsp;$ export GEM\_HOME=/home/mygemrepository  
&nbsp;&nbsp;&nbsp;&nbsp;$ ruby setup.rb config --prefix=/home/mystuff  
&nbsp;&nbsp;&nbsp;&nbsp;$ ruby setup.rb setup  
&nbsp;&nbsp;&nbsp;&nbsp;$ ruby setup.rb install

At the moment, I don't need RUBYOPT because I use  
require 'rubygems'

---

<div class="post-metadata">

**Author:** ![Matt9](https://avatars.discourse-cdn.com/v4/letter/m/ea5d25/32.png) [@Matt9](https://rubytalk.org/u/Matt9)\
**Post date:** [27 November 2006 21:35 UTC](https://rubytalk.org/t/ruby-1-8-5-on-mac-os-x/33244/5 "2006-11-27T21:35:06Z")

</div>

What happens when you say "gem environment" at the command line? m.

> **···**
>
> doog \<doog@google.com\> wrote:
> 
> > Thanks for the info about GEM\_HOME. I set up /usr/local/bin  
> > to be ahead of /usr/bin. I still have trouble getting the gems  
> > to be loaded with the newer /usr/local/bin/ruby
> > 
> > Here's my setup now:  
> > /usr/local/bin/ruby # latest ruby  
> > /usr/lib/ruby/gems/1.8/gems/ # gems
> > 
> > Do I set:  
> > GEM\_HOME=/usr/lib/ruby/gems  
> > or  
> > GEM\_HOME=/usr/lib/ruby/gems/1.8/gems
> > 
> > Also, it's not clear to what values to use for "user directory"  
> > and the "mygemrepository" in the following (taken from the RubyGems  
> > man page: [http://rubygems.org/read/chapter/3\](http://rubygems.org/read/chapter/3%5C))
> > 
> > &nbsp;&nbsp;&nbsp;&nbsp;Use the following to install RubyGems in a user directory  
> > &nbsp;&nbsp;&nbsp;&nbsp;(here called /home/mystuff)  
> > &nbsp;&nbsp;&nbsp;&nbsp;with a repository named /home/mygemrepository):
> > 
> > &nbsp;&nbsp;&nbsp;&nbsp;$ export GEM\_HOME=/home/mygemrepository  
> > &nbsp;&nbsp;&nbsp;&nbsp;$ ruby setup.rb config --prefix=/home/mystuff  
> > &nbsp;&nbsp;&nbsp;&nbsp;$ ruby setup.rb setup  
> > &nbsp;&nbsp;&nbsp;&nbsp;$ ruby setup.rb install
> > 
> > At the moment, I don't need RUBYOPT because I use  
> > require 'rubygems'
> 
> --  
> matt neuburg, phd = matt@tidbits.com, [Matt Neuburg’s Home Page](http://www.tidbits.com/matt/)  
> Tiger - [http://www.takecontrolbooks.com/tiger-customizing.html](http://www.takecontrolbooks.com/tiger-customizing.html)  
> AppleScript - [http://www.amazon.com/gp/product/0596102119](http://www.amazon.com/gp/product/0596102119)  
> Read TidBITS! It's free and smart. [http://www.tidbits.com](http://www.tidbits.com)

---

<div class="post-metadata">

**Author:** ![Pere\_Noel1](https://avatars.discourse-cdn.com/v4/letter/p/d6d6ee/32.png) [@Pere\_Noel1](https://rubytalk.org/u/Pere_Noel1)\
**Post date:** [27 November 2006 21:45 UTC](https://rubytalk.org/t/ruby-1-8-5-on-mac-os-x/33244/6 "2006-11-27T21:45:09Z")

</div>

> Here's my setup now:  
> /usr/local/bin/ruby # latest ruby  
> /usr/lib/ruby/gems/1.8/gems/ # gems

I think you've installed rubygems using /usr/bin/ruby, the Apple's one ?

may be you didn't change your PATH hit before ?

> Do I set:  
> GEM\_HOME=/usr/lib/ruby/gems  
> or  
> GEM\_HOME=/usr/lib/ruby/gems/1.8/gems

neither only :

GEM\_HOME=/usr/lib/ruby/gems/1.8

but i would suspect you could enter into trouble, if i'm right, that's  
to say you've installed rubygems with Apple's Ruby...

personaly in such a situation i would re-install rubygems to insure it  
is linked to the right ruby.

> Also, it's not clear to what values to use for "user directory"  
> and the "mygemrepository" in the following (taken from the RubyGems  
> man page: [http://rubygems.org/read/chapter/3\](http://rubygems.org/read/chapter/3%5C))
> 
> &nbsp;&nbsp;&nbsp;&nbsp;Use the following to install RubyGems in a user directory  
> &nbsp;&nbsp;&nbsp;&nbsp;(here called /home/mystuff)  
> &nbsp;&nbsp;&nbsp;&nbsp;with a repository named /home/mygemrepository):
> 
> &nbsp;&nbsp;&nbsp;&nbsp;$ export GEM\_HOME=/home/mygemrepository  
> &nbsp;&nbsp;&nbsp;&nbsp;$ ruby setup.rb config --prefix=/home/mystuff  
> &nbsp;&nbsp;&nbsp;&nbsp;$ ruby setup.rb setup  
> &nbsp;&nbsp;&nbsp;&nbsp;$ ruby setup.rb install

no need for a repository except you want to download first and install  
afterwards ?

otherwise gem is able to download remotely the gems you want to install.

> At the moment, I don't need RUBYOPT because I use  
> require 'rubygems'

OK, fine.

> **···**
>
> doog \<doog@google.com\> wrote:  
> --  
> une bévue

---

<div class="post-metadata">

**Author:** ![Doug\_Kramer](https://avatars.discourse-cdn.com/v4/letter/d/a183cd/32.png) [@Doug\_Kramer](https://rubytalk.org/u/Doug_Kramer)\
**Post date:** [28 November 2006 02:29 UTC](https://rubytalk.org/t/ruby-1-8-5-on-mac-os-x/33244/7 "2006-11-28T02:29:33Z")

</div>

Got 1.8.5 installed on Macintosh with gems.  
Thanks for all your help. I really appreciate you helping me get past  
this.

Basically, I put "/usr/local/bin" ahead of "/usr/bin" in my PATH in  
~/.profile  
Then I re-installed rubygem to "/usr/local" and

$ ruby setup.rb config --prefix=/usr/local

and re-installed all my gems, which automatically installed them into  
/usr/local/lib/ruby/gems

> **···**
>
> ----------------------------------------------------------------------------  
> Details below...
> 
> > I think you've installed rubygems using /usr/bin/ruby, the Apple's one ?
> 
> Yes. I installed rubygems when Apple's /usr/bin/ruby was the only  
> version on my Mac.
> 
> > may be you didn't change your PATH hit before ?
> 
> You mean change PATH to include /usr/local/bin/ruby before installing  
> rubygems?  
> That would be correct, since /usr/local/bin/ruby didn't yet exist when  
> I installed rubygems.
> 
> > personaly in such a situation i would re-install rubygems to insure it  
> > is linked to the right ruby.
> 
> Okay, I did succeed re-installing ruby gems
> 
> $ cd rubygems-0.9.1  
> $ ruby setup.rb config --prefix=/usr/local
> 
> I figured out which value to pass in to --prefix by looking in  
> setup.rb:
> 
> $ grep setup.rb | grep prefix  
> &nbsp;&nbsp;\_stdruby = "$prefix/lib/ruby/#{version}"
> 
> The argument to --prefix should be clarified in  
> [http://docs.rubygems.org/read/chapter/3](http://docs.rubygems.org/read/chapter/3)
> 
> Calling "gem environment" now prints nicely:
> 
> $ gem environment  
> Rubygems Environment:  
> &nbsp;&nbsp;- VERSION: 0.9.0 (0.9.0)  
> &nbsp;&nbsp;- GEM PATH:  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- /usr/local/lib/ruby/gems/1.8  
> &nbsp;&nbsp;&nbsp;...

---

<div class="post-metadata">

**Author:** ![Pere\_Noel1](https://avatars.discourse-cdn.com/v4/letter/p/d6d6ee/32.png) [@Pere\_Noel1](https://rubytalk.org/u/Pere_Noel1)\
**Post date:** [28 November 2006 05:00 UTC](https://rubytalk.org/t/ruby-1-8-5-on-mac-os-x/33244/8 "2006-11-28T05:00:04Z")

</div>

fine !

> **···**
>
> doog \<doog@google.com\> wrote:
> 
> > and re-installed all my gems, which automatically installed them into  
> > /usr/local/lib/ruby/gems
> 
> --  
> une bévue
