[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

Which version do I have then?

Sebastian Komianos

2/6/2008 4:21:00 AM

Hello there!

After reading the first half of Chris Pine's online tutorial I decided
to buy the book and here I am, preparing my MacBook Pro for my serious
studying which I plan to begin in a few hours.

However, since I am want everything to be up to date, I decided to
update to Ruby 1.9.0 (I previously had 1.8.1). Following this
(http://hivelogic.com/articles/ruby-rails-mongrel-...) I think I
managed to do something, because when I type "ruby -v" on my terminal
I...sometimes take this as the result: ruby 1.9.0 (2007-12-25 revision
14709) [i686-darwin8.11.1]

The "sometimes" goes for the fact that the above only happens when my
folder is "/usr/local/src/ruby-1.9.0". When I am at "/usr/local/src/" or
below, I get this: ruby 1.8.1 (2003-12-25) [i686-darwin]. Which is quite
confusing to me, since it looks like I have both version.

Anyways, I have never had any previous experience with language building
or something relevant so I would really appreciate it if you can tell me
either how to update Ruby or that it doesn't really matter if I have a
previous version. :P

Thanks in advance!
--
Posted via http://www.ruby-....

5 Answers

Phrogz

2/6/2008 4:48:00 AM

0

On Feb 5, 9:21 pm, Sebastian Komianos <seb...@grubies.gr> wrote:
> Hello there!
>
> After reading the first half of Chris Pine's online tutorial I decided
> to buy the book and here I am, preparing my MacBook Pro for my serious
> studying which I plan to begin in a few hours.
>
> However, since I am want everything to be up to date, I decided to
> update to Ruby 1.9.0 (I previously had 1.8.1). Following this
> (http://hivelogic.com/articles/ruby-rails-mongrel-...) I think I
> managed to do something, because when I type "ruby -v" on my terminal
> I...sometimes take this as the result: ruby 1.9.0 (2007-12-25 revision
> 14709) [i686-darwin8.11.1]
>
> The "sometimes" goes for the fact that the above only happens when my
> folder is "/usr/local/src/ruby-1.9.0". When I am at "/usr/local/src/" or
> below, I get this: ruby 1.8.1 (2003-12-25) [i686-darwin]. Which is quite
> confusing to me, since it looks like I have both version.
>
> Anyways, I have never had any previous experience with language building
> or something relevant so I would really appreciate it if you can tell me
> either how to update Ruby or that it doesn't really matter if I have a
> previous version. :P

You may have a variety of binaries installed with the same name, in
different directories. Which version you are using depends on which
binary is 'found' first.

Search for information on the PATH environment variable to understand
how *nix systems resolve the binaries. If you have further questions,
feel free to post again.

I personally have the built-in Ruby Leopard install in /usr/bin/ruby,
my own 1.8.6-p111 build in /usr/local/bin/ruby, and another 1.9 built
as ruby190.

Sebastian Komianos

2/6/2008 5:22:00 AM

0

Gavin Kistner wrote:
> Search for information on the PATH environment variable to understand
> how *nix systems resolve the binaries. If you have further questions,
> feel free to post again.

Sorry but I have no idea on how I am supposed to do this.

> I personally have the built-in Ruby Leopard install in /usr/bin/ruby,
> my own 1.8.6-p111 build in /usr/local/bin/ruby, and another 1.9 built
> as ruby190.

Isn't there an (easy) way I remove any prior to 1.9.0 builts?

Apart from that, am I harming my Mac with all these experiments? It's
just that I can't resist! :D

(Hope I am not "rubbishing" your emails with my newbish questions)
--
Posted via http://www.ruby-....

Tim Hunter

2/6/2008 12:39:00 PM

0

Sebastian Komianos wrote:
> Gavin Kistner wrote:
>> Search for information on the PATH environment variable to understand
>> how *nix systems resolve the binaries. If you have further questions,
>> feel free to post again.
>
> Sorry but I have no idea on how I am supposed to do this.
>
>> I personally have the built-in Ruby Leopard install in /usr/bin/ruby,
>> my own 1.8.6-p111 build in /usr/local/bin/ruby, and another 1.9 built
>> as ruby190.
>
> Isn't there an (easy) way I remove any prior to 1.9.0 builts?
>
> Apart from that, am I harming my Mac with all these experiments? It's
> just that I can't resist! :D
>
> (Hope I am not "rubbishing" your emails with my newbish questions)


My advice? Remove 1.9.0 and just use the Ruby 1.8.6 that is already
installed on your system. 1.9.0 is not "up to date," it's a developer's
version of Ruby that has bugs and undocumented features. All the books
you'll buy, and 99% of the web sites, describe 1.8.6, not 1.9.0, so all
you'll do is confuse yourself. Dump 1.9.0 until you're a Ruby expert.

Also, buy a book about OS X that describes how to use the shell and Unix
commands. You can't use Ruby effectively on OS X by clicking on things.

--
RMagick: http://rmagick.ruby...
RMagick 2: http://rmagick.ruby...rmagick2.html

Phlip

2/6/2008 1:41:00 PM

0

Sebastian Komianos wrote:

> The "sometimes" goes for the fact that the above only happens when my
> folder is "/usr/local/src/ruby-1.9.0". When I am at "/usr/local/src/" or
> below, I get this: ruby 1.8.1 (2003-12-25) [i686-darwin]. Which is quite
> confusing to me, since it looks like I have both version.

From either place, enter:

which ruby

or

whence ruby

I upgraded my Ubuntu, and I get this:

$ whence ruby
ruby is /usr/bin/ruby

I recently built Ruby 1.9, and got the ./configure --prefix wrong, so I
found that ruby and moved it to _ruby:

$ whence _ruby
_ruby is /usr/local/bin/_ruby

That is a vile hack, which I don't recommend anyone doing unless they
know how to live with mildly hacked bin folders.

Now try:

which ruby1.9

Because 1.8.6 is ~ the currently recommended version, and 1.9 is a "beta"
release, the configurator names your executable ruby1.9, so if you really
want that you can get it.

Someone here will know the exact fix for this on MacOSX, but if I really
wanted ruby1.9 I would try this:

Edit my ~/.bashrc, and add ~/bin to my PATH. (Google [bashrc bin export
PATH] for the instructions to do that.) Add ~/bin, naturally, to the left
end of your PATH, not the right.

mkdir ~/bin
cd ~/bin
ln -s `which ruby1.9` ruby

The backticks `` are a trick to insert the path that which returns. If
they give any problem, rm ruby, and type in

ln -s /the/complete/path/to/ruby1.9 ruby

Now your ruby -v will hit 1.9, and all your scripts that use 'ruby' will
hit it, too.

New question for the forum: What will /usr/bin/env ruby -v now return? Is
that significant?

> Anyways, I have never had any previous experience with language
> building or something relevant so I would really appreciate it if
> you can tell me either how to update Ruby or that it doesn't
> really matter if I have a previous version.

Oh, also it really doesn't matter if you have a previous version. 1.9
essentially gives us some new techniques that let us simplify code a
little more than before. You need to learn the general ways to simplify
code, so don't screw up your bin folders, and just learn with whatever
ruby you have!

--
Phlip

Phlip

2/6/2008 2:18:00 PM

0

> My advice? Remove 1.9.0 and just use the Ruby 1.8.6 that is already
> installed on your system.

Actually, the 1.9 appears to be correctly compartmentalized, so the OP
could just ignore it. Then they could get busy learning Ruby, instead of
system administration!