Installing 1.8.7

Would someone please explain to this idiot (me) how to upgrade my
leopard installation to ruby 1.8.7. I’ve seen the instructions at
Hivelogic but I don’t want to install it under a different path.
HELP!!

On 1 juin 08, at 08:25, Ron G. wrote:

Would someone please explain to this idiot (me) how to upgrade my
leopard installation to ruby 1.8.7. I’ve seen the instructions at
Hivelogic but I don’t want to install it under a different path.

Yes, you do want to install it under a different path otherwise any
future system update might silently overwrite your custom install.

Luc H. wrote:

On 1 juin 08, at 08:25, Ron G. wrote:

Would someone please explain to this idiot (me) how to upgrade my
leopard installation to ruby 1.8.7. I’ve seen the instructions at
Hivelogic but I don’t want to install it under a different path.

Yes, you do want to install it under a different path otherwise any
future system update might silently overwrite your custom install.

OK, I’ll do it. But can someone show me how to alter the instructions on
hivelogic to install 1.8.7?

Ron G. wrote:

Luc H. wrote:

On 1 juin 08, at 08:25, Ron G. wrote:

Would someone please explain to this idiot (me) how to upgrade my
leopard installation to ruby 1.8.7. I’ve seen the instructions at
Hivelogic but I don’t want to install it under a different path.

Yes, you do want to install it under a different path otherwise any
future system update might silently overwrite your custom install.

OK, I’ll do it. But can someone show me how to alter the instructions on
hivelogic to install 1.8.7?

Her are the instructions for 1.8.6. How do I modify this for 1.8.7?

curl -O ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.6-p111.tar.gz
tar xzvf ruby-1.8.6-p111.tar.gz
cd ruby-1.8.6-p111
./configure --enable-shared --enable-pthread CFLAGS=-D_XOPEN_SOURCE=1
make
sudo make install
cd …

Ron G. wrote:

Her are the instructions for 1.8.6. How do I modify this for 1.8.7?

curl -O ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.6-p111.tar.gz
tar xzvf ruby-1.8.6-p111.tar.gz
cd ruby-1.8.6-p111
./configure --enable-shared --enable-pthread CFLAGS=-D_XOPEN_SOURCE=1
make
sudo make install
cd …

Well, let’s take it step-by-step…

Use your browser to navigate to www.ruby-lang.org. Download
ruby-1.8.7.tar.gz to your home directory.

We can tell by looking at the file suffixes that ruby-1.8.7.tar.gz is a
file created by the tar(1) command and then zipped by the gzip(1)
command. You can find out more about these commands by entering “man
tar” and “man gzip” at the command line, or searching for “man tar” and
“man gzip” with Google. The command

tar xvzf

uses the x, v, z, and f options. These options tell tar to eXtract
Verbosely a gZipped File named . Since you downloaded
ruby-1.8.7.tar.gz, then you’ll use the command

tar xvzf ruby-1.8.7.tar.gz

This command will create a directory named ‘ruby-1.8.7’ and store within
that directory all the files in the ruby-1.8.7 distribution. Make that
directory the current directory:

cd ruby-1.8.7

Within that directory is a shell script named ‘configure’. You can get
help about using configure by entering

./configure --help

The configure script has a lot of options, some of which are very
interesting and bear studying. (Hint: --enable-install-doc.) Determine
the set of options you want to use and run the configure script again.
Note that the configure script uses the --prefix option to determine
where to install Ruby, and the default value of --prefix is /usr/local.

./configure --enable-shared --enable-pthread …or whatever…

If you get any error messages, correct the problems and run configure
again. Probably you won’t, but it pays to check. After the configure
script runs successfully, run make(1)

make

Again, watch for errors. If you get any errors, correct them. Probably
they’ll be caused by some configuration problem. After make completes
successfully, run “make install”. If you’ve used the default --prefix
option, and you don’t already have permission to write into /usr/local,
then you’ll have to use sudo(8) (or su(1), or some other mechanism) to
get permission.

sudo make install

After “make install” has run successfully and you’ve confirmed that Ruby
is installed to your satisfaction you can delete the ruby-1.8.7
directory. Don’t do this immediately, because if you want to change
something you can just run the configure script, make, and make install
again. (However, if you decide to change the installation directory
remember that you’ll have to manually uninstall Ruby from /usr/local, or
wherever you previously installed it.)

You may also find the “make test”, “make clean”, and “make distclean”
commands useful, but I’ll leave it to you to explore what they do.

Now make sure that /usr/local/bin (or, if you specified some other
directory $prefix with the --prefix option, $prefix/bin) precedes
/usr/bin in your PATH environment variable. You can do this temporarily
in the current shell with the export(1) command:

export PATH=/usr/local/bin:$PATH

To set this permanently put the export command in your .profile or some
other initialization file appropriate for your shell.

Verify that you’re getting Ruby 1.8.7:

ruby -v

It’s generally not a good idea to override Mac OS X’s ruby because, as
Luc noticed, a future software update might override your custom
install, but also it might break the system itself, because some of
its functionality is written in Ruby and could be broken if an
incompatible version is used.

Laurent