Biting the Bullet
After reading more about Ruby development on the Mac, especially about RubyCocoa, I just couldn't stand not having enough control over my system to install the latest-and-greatest bits.
My goal: install Ruby 1.9 on Leopard. (I don't particularly care about Rails at this point.)
The standard resource for this is Hivelogic. Unfortunately, it is not up-to-date (despite promises to make it so).
I created a ~/.bash_login (using Textmate), in which I added the line:
export PATH="/usr/local/bin:/usr/local/sbin:$PATH"
I created the path he suggests for managing our source code:
sudo mkdir -p /usr/local/src
sudo chgrp admin /usr/local/src
sudo chmod -R 775 /usr/local/src
cd /usr/local/src
Next, I did a little reading on the use of readline 5.2. His instructions call for using the 5.1 bits, but those are not the latest. It turns out, there are a few problems.
I downloaded the latest version:
curl -O ftp://ftp.gnu.org/gnu/readline/readline-5.2.tar.gz
tar xzvf readline-5.2.tar.gz
cd readline-5.2
I next applied the patch to support/shobj-conf (I just did this manually --- it only really consists of adding a '9' to two places):
+darwin89*)
+ darwin[789]*) SHOBJ_LDFLAGS=''
Now, there is also discussion of the need to compile readline statically due to a problem with GCC. But, OSX 10.5.2 was just released, so I upgraded and ignored the static business and proceeded to compile per the original Hive instructions:
./configure --prefix=/usr/local
make
sudo make install
cd ..
Everything seemed to go smoothly. Well, at least I didn't get the usual error message pre-10.5.2. I did, however, receive a few cryptic messages during make:
install: you may need to run ldconfig
ldconfig apparently updates links and caches for newly installed libraries. After a little research, it also appears that this can be ignored. I'm not so sure, but I'm not sure how to validate my build of readline. The libs all appear in usr/local/libs, so we'll see...
The modified Hive instructions are:
curl -O ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.0-0.tar.gz
tar xzvf ruby-1.9.0-0.tar.gz
cd ruby-1.9.0-0
./configure --prefix=/usr/local --enable-pthread --with-readline-dir=/usr/local --enable-shared
make
sudo make install
sudo make install-doc
cd ..
The result of ruby -v (from the src directory, since this also reveals whether or not the PATH is properly configured) is:
ruby 1.9.0 (2007-12-25 revision 14709) [i686-darwin9.2.0]
Yay!
I couldn't find anyway to verify which version of readline is being used, but irb works just fine, including statement completion:
irb --readline -r irb/completion
Next up, RubyGems. Using (modified) Hivemind instructions:
curl -O http://files.rubyforge.mmmultiworks.com/rubygems/rubygems-1.0.1.tgz
tar xzvf rubygems-1.0.1.tgz
cd rubygems-1.0.1
sudo /usr/local/bin/ruby setup.rb
cd ..
The result of gem -v results in:
1.0.1
Yay! I tried a few more gems commands (environment, list), and all seems right.
Well, it appears that everything is setup properly. Now it is time to get to developing some things...