Ruby on Snow Leopard
As you all know, Apple released the Snow Leopard. With the promises of smaller footprint, performance boost, and better 64-bit meant the upgrade is a mandatory for me. Naturally, I upgraded to Snow Leopard and at the same time, upgraded my Macbook Pro. Apple is including Snow Leopard disk along with the new computers and despite what they say on the net, you CAN do the clean install.
I installed 64-bit version MySQL straight from the package version. I recommend just downloading from mysql.com rather than dicking around with Fink or Macport. I just don’t see the need. Besides, the only reason why I have MySQL is all my projects haven’t moved to Postgres. I just copied the data directory from the old MBP and everything works without any hiccups.
Snow Leopard comes with Ruby 1.8.7. This is a problem for me since I haven’t had a good experience with this particular version. My projects aren’t the latest version of Rails. Couple of my projects are loaded with plugins (I’ll talk about my hatred towards plugins some other time) that break on version 1.8.7. So, what does a Rubyhead do?
Install Ruby 1.8.6 by compiling from the source, but do not overwrite the existing Ruby. Here’s a summary of what I did.
1) I changed the added following line to /etc/profile so that /opt directory is the first directory before other directories.
export PATH=/opt/bin:/opt/sbin:/usr/local/mysql/bin:$PATH
2) Downloaded latest Ruby 1.8.6 from ftp://ftp.ruby-lang.org/pub/ruby/1.8
3) I found it really interesting that I can compile from source without too much hassle.
./configure --prefix=/opt --enable-pthread --enable-shared CFLAGS=-D_XOPEN_SOURCE=1
make
sudo make install
4) As always, I went into {ruby source directory}/ext and checked individual extensions.. The best thing is that I didn’t have to download anything.
ruby extconf.rb
make clean
sudo make install
5) I then downloaded Rubygems and installed it. Why? Because I wanted the original gems intact.
ruby setup.rb --prefix=/opt
6) Now that I have both Ruby and Rubygems installed, just do “sudo gems install” all your gems. You’re good to go. The only thing that I did differently was for MySQL. I wanted to make sure any extensions are 64-bit.
sudo env ARCHFLAGS="-arch x86_64" gem install mysql
Notice that I didn’t have to do “–mysql-config=”. Nice!
That’s all! Now I’m running with Ruby 1.8.6.
Hey, what about Ruby Enterprise Edition?
The make failed for me and I really didn’t want to find out since this is my development machine. Besides, I was just too damn tired.
Hope this helps. I’ll start doing some screencasts as soon as I’m up and running on the new machine.