Setting up ruby on os x 10.2

Hi All!

I just downloaded ruby and did the configure, make, make test and make install as per the instructions on the 1.8.2 version's readme...

It seemed to all go wonderfully... until after I did that, I typed "ruby -v" to find the version, and I was still on 1.6.7 as per the previous install.

So, I did a "which ruby" and it said "/usr/bin" - which was interesting to me, because the make install script installed it into /usr/local/bin...

so I thought... I'll rm the /usr/bin one and link it to /usr/local/bin/ruby... so I did that... then all seemed well... downloaded the rubygems 0.8 tar and untarred it... ran ruby setup.rb and it kinda hung with an error... and it half-installed...

Any ideas on how to fix this? I have a feeling I didn't install ruby 1.8.2 properly or I didn't do some stuff I needed to do...

Any help would be quite appreciated.

Thanks!

Julian.

Julian,

So, I did a "which ruby" and it said "/usr/bin" - which was interesting to me, because the make install script installed it into / usr/local/bin...

so I thought... I'll rm the /usr/bin one and link it to /usr/local/ bin/ruby... so I did that... then all seemed well... downloaded the rubygems 0.8 tar and untarred it... ran ruby setup.rb and it kinda hung with an error... and it half-installed...

Any ideas on how to fix this? I have a feeling I didn't install ruby 1.8.2 properly or I didn't do some stuff I needed to do...

You probably installed it just fine, but you need to add /usr/local/bin to your path. The original ruby is in /usr/bin and its libraries are in /usr/lib/ruby, but the version you installed put ruby in /usr/local/bin and the libraries in /usr/local/lib/ruby.

I'm not at my OS X machine right now, but I don't think I had to mess with anything other than the path. I also deleted /usr/bin/ruby, /usr/bin/irb (I think), and the whole /usr/lib/ruby directory.

Jim

···

--
Jim Menard, jimm@io.com, http://www.io.com/~jimm
"A language that doesn't affect the way you think about programming, is not
worth knowing." -- Alan J. Perlis

Actually, if I remember correctly, /usr/local/bin *is* in the default
path; however, it's listed after /usr/bin, so the Apple-provided
version gets loaded first.

I've found it most useful to simply rename the pre-installed ruby
binaries (ruby, irb, erb, etc.) in /usr/bin with a '16' suffix, such as
'ruby16' -- that way, scripts with a hard-coded path to the Ruby
interpreter will fail at startup, rather than mysteriously running in
the older version (and usually not finding libraries, or hitting old
1.6.7 incompatibilities, or whatever).

Forgive me if I am coming in late on this post but:

> ran ruby setup.rb and it kinda
> hung with an error... and it half-installed...

What was the error?

I had some strange errors when installing rubygems on OSX also. I
didn't have much luck changing the path so to get it working, I
renamed the ruby directory in /usr/bin and like you, created a symlink
to /usr/local/bin/ruby. Rubygems then installed properly but I had to
make sure that I installed it as superuser.

If you plan to install rails or anything like that, you'll need to
create another symlink in usr/bin to usr/local/bin/rails.

Good luck,
Eddie

···

On 8/2/05, Jim Menard <jimm@io.com> wrote:

Julian,

> So, I did a "which ruby" and it said "/usr/bin" - which was
> interesting to me, because the make install script installed it into /
> usr/local/bin...
>
> so I thought... I'll rm the /usr/bin one and link it to /usr/local/
> bin/ruby... so I did that... then all seemed well... downloaded the
> rubygems 0.8 tar and untarred it... ran ruby setup.rb and it kinda
> hung with an error... and it half-installed...
>
> Any ideas on how to fix this? I have a feeling I didn't install ruby
> 1.8.2 properly or I didn't do some stuff I needed to do...

You probably installed it just fine, but you need to add /usr/local/bin to
your path. The original ruby is in /usr/bin and its libraries are in
/usr/lib/ruby, but the version you installed put ruby in /usr/local/bin and
the libraries in /usr/local/lib/ruby.

I'm not at my OS X machine right now, but I don't think I had to mess with
anything other than the path. I also deleted /usr/bin/ruby, /usr/bin/irb (I
think), and the whole /usr/lib/ruby directory.

Jim
--
Jim Menard, jimm@io.com, http://www.io.com/~jimm
"A language that doesn't affect the way you think about programming, is not
worth knowing." -- Alan J. Perlis

/usr/local/bin appears to be in my path.

I deleted /usr/bin/ruby but not irb, and not /usr/lib/ruby dir - should I delete these?

Julian.

···

On 03/08/2005, at 3:00 AM, Jim Menard wrote:

Julian,

So, I did a "which ruby" and it said "/usr/bin" - which was interesting to me, because the make install script installed it into / usr/local/bin...
so I thought... I'll rm the /usr/bin one and link it to /usr/local/ bin/ruby... so I did that... then all seemed well... downloaded the rubygems 0.8 tar and untarred it... ran ruby setup.rb and it kinda hung with an error... and it half-installed...
Any ideas on how to fix this? I have a feeling I didn't install ruby 1.8.2 properly or I didn't do some stuff I needed to do...

You probably installed it just fine, but you need to add /usr/local/bin to your path. The original ruby is in /usr/bin and its libraries are in /usr/lib/ruby, but the version you installed put ruby in /usr/local/bin and the libraries in /usr/local/lib/ruby.

I'm not at my OS X machine right now, but I don't think I had to mess with anything other than the path. I also deleted /usr/bin/ruby, /usr/bin/irb (I think), and the whole /usr/lib/ruby directory.

Jim
--
Jim Menard, jimm@io.com, http://www.io.com/~jimm
"A language that doesn't affect the way you think about programming, is not
worth knowing." -- Alan J. Perlis

There is no reason to delete Apple's 1.6.x Ruby at all. Just make sure
that /usr/local/bin is in front of /usr/bin in your path:

mark@eMac% echo $PATH
/usr/local/bin:/usr/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R6/bin:/usr/local/mysql/bin:/usr/local/mysql/sbin:/Developer/Tools:.

Since /usr/local/bin is first in the path, apple's ruby will never be
used unless you change your path. Yes, you have to make sure that any
shebangs point to the right place, though. (which is why I use
"#!/usr/bin/env ruby")

Leaving the 1.6.x install there lets you have a compatability version,
since 1.6.x is installed on many many *many* boxes right now.

:confused: sorry if this sounds like a rant. I suppose it is, a bit...

cheers,
Mark

···

On 8/2/05, Julian Leviston <julian@coretech.net.au> wrote:

/usr/local/bin appears to be in my path.

I deleted /usr/bin/ruby but not irb, and not /usr/lib/ruby dir -
should I delete these?

Julian.

I'm not sure how this works, but my path WAS and IS this:

/sw/bin /sw/sbin /usr/local/bin /bin /sbin /usr/bin /usr/sbin /usr/X11R6/bin

Which is a bit interesting, because typing ruby -v would echo 1.6.7 which was kinda weird... because I had 1.8.2 installed. After deleting / hardlilnking / symlinking, of course it does 1.8.2... but I *STILL* can't get gem installed.

Any further ideas?

Julian.

···

On 03/08/2005, at 4:57 PM, Mark Hubbart wrote:

On 8/2/05, Julian Leviston <julian@coretech.net.au> wrote:

/usr/local/bin appears to be in my path.

I deleted /usr/bin/ruby but not irb, and not /usr/lib/ruby dir -
should I delete these?

Julian.

There is no reason to delete Apple's 1.6.x Ruby at all. Just make sure
that /usr/local/bin is in front of /usr/bin in your path:

mark@eMac% echo $PATH
/usr/local/bin:/usr/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R6/bin:/usr/local/mysql/bin:/usr/local/mysql/sbin:/Developer/Tools:.

Since /usr/local/bin is first in the path, apple's ruby will never be
used unless you change your path. Yes, you have to make sure that any
shebangs point to the right place, though. (which is why I use
"#!/usr/bin/env ruby")

Leaving the 1.6.x install there lets you have a compatability version,
since 1.6.x is installed on many many *many* boxes right now.

:confused: sorry if this sounds like a rant. I suppose it is, a bit...

cheers,
Mark

I'm still not sure, if gem has install rails or not. The Non-existence of
/usr/local/bin/rails is just ONE circumstantial evidence. Try to find something
like /usr/local/lib/ruby/gems/1.8/gems/rails-x.y.z . This would indicate, that
gem ha successfully downloaded and extraced the rails-gem.

I bet ruby (1.6.7) lays under /sw/bin and the first path wins.
/usr/local/bin/ruby isn't recognized.

try
which ruby

or
type -p ruby

to see, which ruby the shell is takeing.

and do a
find -name rails

under /usr/local.

and do a
find -name rails

under /usr/local. You may have done that already. I don't know.

best regards
ralf

···

On Wed, 3 Aug 2005 20:13:55 +0900 Julian Leviston <julian@coretech.net.au> wrote:

I'm not sure how this works, but my path WAS and IS this:

/sw/bin /sw/sbin /usr/local/bin /bin /sbin /usr/bin /usr/sbin /usr/
X11R6/bin

Which is a bit interesting, because typing ruby -v would echo 1.6.7
which was kinda weird... because I had 1.8.2 installed. After
deleting / hardlilnking / symlinking, of course it does 1.8.2... but
I *STILL* can't get gem installed.

Any further ideas?

the /sw/bin and /sw/sbin concern me. Do you use fink? Did you ever
install ruby with fink? is there anything under /sw related to ruby.
Did you compile and install your own ruby? When you ran 'ruby
setup.rb' did you run it with sudo or logged in as root?

Also, when your gem install failed, did you still have the Apple
provided ruby in your path? Quite possibly gem could have installed
to /usr/local but still be pointing at /usr. I've had this problem
before.

Once you've got /usr/local/bin ahead of /usr/bin in your PATH, then
untar a new copy of the RubyGems distribution and run ./configure
again. Then try to build it.

Also, I see the subject says 10.2? I wonder if this might be a
problem? I bet most users here are at least using 10.3, if not 10.4.

Let us know if any of this helps.

Jason

···

On 8/3/05, Julian Leviston <julian@coretech.net.au> wrote:

I'm not sure how this works, but my path WAS and IS this:

/sw/bin /sw/sbin /usr/local/bin /bin /sbin /usr/bin /usr/sbin /usr/
X11R6/bin

Which is a bit interesting, because typing ruby -v would echo 1.6.7
which was kinda weird... because I had 1.8.2 installed. After
deleting / hardlilnking / symlinking, of course it does 1.8.2... but
I *STILL* can't get gem installed.

Any further ideas?

Julian.

On 03/08/2005, at 4:57 PM, Mark Hubbart wrote:

> On 8/2/05, Julian Leviston <julian@coretech.net.au> wrote:
>
>> /usr/local/bin appears to be in my path.
>>
>> I deleted /usr/bin/ruby but not irb, and not /usr/lib/ruby dir -
>> should I delete these?
>>
>> Julian.
>>
>
> There is no reason to delete Apple's 1.6.x Ruby at all. Just make sure
> that /usr/local/bin is in front of /usr/bin in your path:
>
> mark@eMac% echo $PATH
> /usr/local/bin:/usr/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/
> X11R6/bin:/usr/local/mysql/bin:/usr/local/mysql/sbin:/Developer/
> Tools:.
>
> Since /usr/local/bin is first in the path, apple's ruby will never be
> used unless you change your path. Yes, you have to make sure that any
> shebangs point to the right place, though. (which is why I use
> "#!/usr/bin/env ruby")
>
> Leaving the 1.6.x install there lets you have a compatability version,
> since 1.6.x is installed on many many *many* boxes right now.
>
> :confused: sorry if this sounds like a rant. I suppose it is, a bit...
>
> cheers,
> Mark
>
>

I haven't installed rails yet.

I'm still trying to install gem...

I did which ruby and it said /usr/bin now I've deleted that (1.6.7) it now says /usr/local/bin (1.8.2)

So I'm using the correct Ruby... but maybe something else wrong?

Julian.

···

On 03/08/2005, at 10:38 PM, Ralf Müller wrote:

On Wed, 3 Aug 2005 20:13:55 +0900 > Julian Leviston <julian@coretech.net.au> wrote:

I'm not sure how this works, but my path WAS and IS this:

/sw/bin /sw/sbin /usr/local/bin /bin /sbin /usr/bin /usr/sbin /usr/
X11R6/bin

Which is a bit interesting, because typing ruby -v would echo 1.6.7
which was kinda weird... because I had 1.8.2 installed. After
deleting / hardlilnking / symlinking, of course it does 1.8.2... but
I *STILL* can't get gem installed.

Any further ideas?

I'm still not sure, if gem has install rails or not. The Non-existence of
/usr/local/bin/rails is just ONE circumstantial evidence. Try to find something
like /usr/local/lib/ruby/gems/1.8/gems/rails-x.y.z . This would indicate, that
gem ha successfully downloaded and extraced the rails-gem.

I bet ruby (1.6.7) lays under /sw/bin and the first path wins.
/usr/local/bin/ruby isn't recognized.

try
which ruby

or
type -p ruby

to see, which ruby the shell is takeing.

and do a
find -name rails

under /usr/local.

and do a
find -name rails

under /usr/local. You may have done that already. I don't know.

best regards
ralf

Hi.

Yes, I use fink. No I never installed ruby with fink (unless it was a dependent package that I was unaware of for something else).
I checked and there doesn't seem to be anything under /sw or /sw/bin relating to ruby (ls -la | grep ruby returned nada)
Yes I complied made and installed my own ruby...
when I ran ruby setup.rb I did it as root.

We can't upgrade this machine to 10.3 or .4. But yeah, on my dev machine, I'm using 10.4... it was a pain to set up as well...

I just tried a package install then... and that didn't work either - not sure if it would have overwritten files or not... I might untar another copy of the rubygems distribution again... <sigh> :slight_smile:

Thanks

Julian.

···

On 03/08/2005, at 11:09 PM, Jason Foreman wrote:

the /sw/bin and /sw/sbin concern me. Do you use fink? Did you ever
install ruby with fink? is there anything under /sw related to ruby.
Did you compile and install your own ruby? When you ran 'ruby
setup.rb' did you run it with sudo or logged in as root?

Also, when your gem install failed, did you still have the Apple
provided ruby in your path? Quite possibly gem could have installed
to /usr/local but still be pointing at /usr. I've had this problem
before.

Once you've got /usr/local/bin ahead of /usr/bin in your PATH, then
untar a new copy of the RubyGems distribution and run ./configure
again. Then try to build it.

Also, I see the subject says 10.2? I wonder if this might be a
problem? I bet most users here are at least using 10.3, if not 10.4.

Let us know if any of this helps.

Jason

On 8/3/05, Julian Leviston <julian@coretech.net.au> wrote:

I'm not sure how this works, but my path WAS and IS this:

/sw/bin /sw/sbin /usr/local/bin /bin /sbin /usr/bin /usr/sbin /usr/
X11R6/bin

Which is a bit interesting, because typing ruby -v would echo 1.6.7
which was kinda weird... because I had 1.8.2 installed. After
deleting / hardlilnking / symlinking, of course it does 1.8.2... but
I *STILL* can't get gem installed.

Any further ideas?

Julian.

On 03/08/2005, at 4:57 PM, Mark Hubbart wrote:

On 8/2/05, Julian Leviston <julian@coretech.net.au> wrote:

/usr/local/bin appears to be in my path.

I deleted /usr/bin/ruby but not irb, and not /usr/lib/ruby dir -
should I delete these?

Julian.

There is no reason to delete Apple's 1.6.x Ruby at all. Just make sure
that /usr/local/bin is in front of /usr/bin in your path:

mark@eMac% echo $PATH
/usr/local/bin:/usr/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/
X11R6/bin:/usr/local/mysql/bin:/usr/local/mysql/sbin:/Developer/
Tools:.

Since /usr/local/bin is first in the path, apple's ruby will never be
used unless you change your path. Yes, you have to make sure that any
shebangs point to the right place, though. (which is why I use
"#!/usr/bin/env ruby")

Leaving the 1.6.x install there lets you have a compatability version,
since 1.6.x is installed on many many *many* boxes right now.

:confused: sorry if this sounds like a rant. I suppose it is, a bit...

cheers,
Mark

You might have better luck using DarwinPorts. Once it's installed it's just 'port install ruby' and then 'port install rb-rubygems'.

Doing that gave me a new Ruby 1.8.2 (2004-12-25) a new gems version (0.8.10) readline in irb, and an easy way to keep things up to date.

Ben