# Ruby 1.8.5 on Mac OS X

**URL:** <https://www.ruby-forum.com/t/ruby-1-8-5-on-mac-os-x/77400>\
**Category:** Ruby\
**Created:** [November 27, 2006, 6:26pm UTC](https://www.ruby-forum.com/t/ruby-1-8-5-on-mac-os-x/77400 "2006-11-27T18:26:10Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![doog](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/c68b51/32.png) [@doog](https://www.ruby-forum.com/u/doog)\
**Post date:** [November 27, 2006, 6:26pm UTC](https://www.ruby-forum.com/t/ruby-1-8-5-on-mac-os-x/77400/1 "2006-11-27T18:26:10Z")

</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:** ![doog](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/c68b51/32.png) [@doog](https://www.ruby-forum.com/u/doog)\
**Post date:** [November 27, 2006, 6:46pm UTC](https://www.ruby-forum.com/t/ruby-1-8-5-on-mac-os-x/77400/2 "2006-11-27T18:46:11Z")

</div>

doog [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> 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?

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.

---

<div class="post-metadata">

**Author:** ![doog](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/c68b51/32.png) [@doog](https://www.ruby-forum.com/u/doog)\
**Post date:** [November 27, 2006, 6:52pm UTC](https://www.ruby-forum.com/t/ruby-1-8-5-on-mac-os-x/77400/3 "2006-11-27T18:52:12Z")

</div>

On Nov 27, 2006, at 11:25 AM, doog wrote:

> 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,

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] [UNIX / Linux Tutorial for Beginners](http://www.ee.surrey.ac.uk/Teaching/Unix/)

---

<div class="post-metadata">

**Author:** ![doog](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/c68b51/32.png) [@doog](https://www.ruby-forum.com/u/doog)\
**Post date:** [November 27, 2006, 9:02pm UTC](https://www.ruby-forum.com/t/ruby-1-8-5-on-mac-os-x/77400/4 "2006-11-27T21:02:35Z")

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

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

$ export GEM_HOME=/home/mygemrepository
$ ruby setup.rb config --prefix=/home/mystuff
$ ruby setup.rb setup
$ ruby setup.rb install

```

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

---

<div class="post-metadata">

**Author:** ![doog](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/c68b51/32.png) [@doog](https://www.ruby-forum.com/u/doog)\
**Post date:** [November 28, 2006, 3:31am UTC](https://www.ruby-forum.com/t/ruby-1-8-5-on-mac-os-x/77400/5 "2006-11-28T03:31: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  
\_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:

- VERSION: 0.9.0 (0.9.0)
- GEM PATH:
  - /usr/local/lib/ruby/gems/1.8  
…

---

<div class="post-metadata">

**Author:** ![doog](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/c68b51/32.png) [@doog](https://www.ruby-forum.com/u/doog)\
**Post date:** [November 27, 2006, 10:46pm UTC](https://www.ruby-forum.com/t/ruby-1-8-5-on-mac-os-x/77400/6 "2006-11-27T22:46:54Z")

</div>

doog [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

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

> ```
> $ ruby setup.rb config --prefix=/home/mystuff
> $ ruby setup.rb setup
> $ 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.

---

<div class="post-metadata">

**Author:** ![doog](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/c68b51/32.png) [@doog](https://www.ruby-forum.com/u/doog)\
**Post date:** [November 27, 2006, 10:36pm UTC](https://www.ruby-forum.com/t/ruby-1-8-5-on-mac-os-x/77400/7 "2006-11-27T22:36:50Z")

</div>

doog [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> or  
> $ export GEM\_HOME=/home/mygemrepository  
> $ ruby setup.rb config --prefix=/home/mystuff  
> $ ruby setup.rb setup  
> $ ruby setup.rb install
> 
> At the moment, I don’t need RUBYOPT because I use  
> require ‘rubygems’

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

---

<div class="post-metadata">

**Author:** ![doog](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/c68b51/32.png) [@doog](https://www.ruby-forum.com/u/doog)\
**Post date:** [November 28, 2006, 6:01am UTC](https://www.ruby-forum.com/t/ruby-1-8-5-on-mac-os-x/77400/8 "2006-11-28T06:01:57Z")

</div>

doog [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

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

fine !
