EDIT: include libyaml
UPDATE 2012-05-30: I have successfully installed
Mac OS Snow Leopard comes with a pretty old Ruby:
You can download and compile the latest Ruby from source. You'll need to have XCode and libyaml installed first. Download libyaml from http://pyyaml.org/wiki/LibYAML and extract it in your
Download the latest Ruby from http://www.ruby-lang.org/en/downloads/ and then extract it in your
Configure for compilation with
Compile:
(I tried that with the latest stable,
Install:
You can either always specify the path to it or you can add it to your
UPDATE 2012-05-30: I have successfully installed
ruby-1.9.3-p194
(latest stable) using the same procedure.Mac OS Snow Leopard comes with a pretty old Ruby:
$ ruby --version ruby 1.8.7 (2010-01-10 patchlevel 249) [universal-darwin11.0]
You can download and compile the latest Ruby from source. You'll need to have XCode and libyaml installed first. Download libyaml from http://pyyaml.org/wiki/LibYAML and extract it in your
Source
directory:$ cd Source $ tar xzf ~/Downloads/yaml-0.1.4.tar.gz $ cd yaml-0.1.4/ $ CC=clang ./configure --prefix=/usr/local/yaml-0.1.4... output omitted ... $ make... output omitted ... $ sudo make install... output omitted ...
Download the latest Ruby from http://www.ruby-lang.org/en/downloads/ and then extract it in your
Source
directory:$ cd Source/ $ tar xzf ~/Downloads/ruby-1.9.3-p0.tar.gz $ cd ruby-1.9.3-p0/
Configure for compilation with
clang
and installation in /usr/local/
:$ CC=clang LDFLAGS=-L/usr/local/yaml-0.1.4/lib CPPFLAGS=-I/usr/local/yaml-0.1.4/include ./configure --prefix=/usr/local/ruby-1.9.3-p0... output omitted ...
Compile:
$ make... output omitted ... $ make test... output omitted ... PASS all 943 tests ... output omitted ... PASS all 1 tests
(I tried that with the latest stable,
ruby-1.9.2-p290
, and some tests failed there, so I didn't use it.)Install:
$ sudo make install... output omitted ... $ /usr/local/ruby-1.9.3-p0/bin/ruby --version ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-darwin11.2.0]
You can either always specify the path to it or you can add it to your
PATH
variable.