[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Ruby 1.8.5 on Mac OS X

doog

11/27/2006 5:25:00 PM

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


7 Answers

pere.noel

11/27/2006 5:43:00 PM

0

doog <doog@google.com> wrote:

> so I downloaded Ruby 1.8.5 source from:
> http://www2.ruby-lang.org/en/200...
> 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?

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.
--
une bévue

Chuck Remes

11/27/2006 5:50:00 PM

0


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/200...
> 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,

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


doog

11/27/2006 8:02:00 PM

0

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

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'


matt

11/27/2006 9:30:00 PM

0

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

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


--
matt neuburg, phd = matt@tidbits.com, http://www.tidbits...
Tiger - http://www.takecontrolbooks.com/tiger-custom...
AppleScript - http://www.amazon.com/gp/product/...
Read TidBITS! It's free and smart. http://www.t...

pere.noel

11/27/2006 9:43:00 PM

0

doog <doog@google.com> 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.

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

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.
--
une bévue

doog

11/28/2006 2:30:00 AM

0

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

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


pere.noel

11/28/2006 4:59:00 AM

0

doog <doog@google.com> wrote:

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

fine !
--
une bévue