small medium large xlarge

Hell_pragsmall
19 Mar 2009, 01:53
David Rossi (9 posts)

I am trying to figure out how to upgrade to Ruby 1.8.7. Running GEM UPGRADE RUBY states that “Nothing To Update”. So how do I update?

Also, I purchased the Ruby Programming book but it is written for version 1.9. Where can I find an OS X install for that? I tried to build it but got too many errors. I would prefer to do a GEM INSTALL. But how?

Thanks. I really enjoy your books.

Generic-user-small
19 Mar 2009, 04:11
Yvan Cottyn (3 posts)

for ruby 1.9:

You can install it using macports (http://www.macports.org/). sudo port install ruby19

this will not replace the 1.8 ruby that comes with Leopard. it is installed as /opt/local/bin/ruby1.9 (ri1.9, rake1.9 and rdoc1.9 are there as well)

Hell_pragsmall
19 Mar 2009, 12:47
David Rossi (9 posts)

OK. What about Ruby 1.8.7?

28555da_pragsmall
19 Mar 2009, 19:24
David Wilbur (49 posts)

i have the apples development environment installed (that used to be a requirement to get a fully functional version of gcc… not sure if that is the case any more) so i just do the following:

cd to where i want it downloaded it in terminal, and then type the folowing

curl ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p72.tar.gz -o ruby-1.8.7-p72.tar.gz
tar zxvf ruby-1.8.7-p72.tar.gz
cd ruby-1.8.7-p72
./configure
make
sudo make install

you will need to type a password for sudo. configure might complain about things it can’t find or are not current. you might have to install other things. eg: apples bison/yacc is a common thing complained about since it is/was a lot older then most things want.

if you ask for help from configure, it will tell you (among other things) that:

./configure --help 

By default, `make install' will install all the files in
`/usr/local/bin', `/usr/local/lib' etc.  You can specify
an installation prefix other than `/usr/local' using `--prefix',
for instance `--prefix=$HOME'.

thus if you do a:

which ruby

if it doesn’t come back saying /usr/local/bin/ruby and instead says /usr/bin/ruby then you need to change your path to use the one in /usr/local/bin. i would advise against replacing the one in /usr/bin since that is updated by apple.

also, ruby-1.8.7-p72.tar.gz is currently the “current” version… that might change in the future. changing your path might have some other impacts, if you have overlapping software in /usr/local/bin vs /usr/bin. for example, i have gem and others installed in /usr/local/bin. lastly, you will probably have to reinstall gems that you have installed already.

this solution is not for everyone, since it means your getting more involved in the management of software on the machine. i like it because it means, i know what software is on the machine, and also when it is updated… because i do the updating.

hope that helps.

Hell_pragsmall
19 Mar 2009, 18:11
David Rossi (9 posts)

Thanks. I will try it tonight.

Samr_small_pragsmall
19 Mar 2009, 20:15
Sam Ruby (634 posts)

Ruby 1.8.6 is also quite fine for the purposes of following along with the examples in this book – I don’t believe that there is anything that is 1.8.7 specific covered.

Generic-user-small
19 Mar 2009, 23:18
Bharat Ruparel (148 posts)

Don’t upgrade to 1.8.7. It is not worth the trouble. Stay with 1.8.6 patch 286 until Rail 2.3 begins to play nicely with Ruby 1.9.x.

Hell_pragsmall
20 Mar 2009, 01:28
David Rossi (9 posts)

OK. 8.6 it is!

You must be logged in to comment