Gathan Beaga

compiling and installing ruby on MacOSX 10.2

The first problem I’ve encountered with Ruby is that all the best Ruby toys (like Instiki and Ruby on Rails) require at least Ruby 1.8… whereas on MacOSX 10.2 there’s only a measly 1.6.7 or thereabouts (you can see what version you have running by typing “ruby -v” in the Terminal). And it turns out that the binary installer for Ruby 1.8.2 that’s available here will not install on MacOSX 10.2.

So… time to venture into the unknown and compile and install it for myself. Here’s what I did (bearing in mind I have Apple’s Developer tools installed, and that I’m currently running as an admin user)…

  • Downloaded Ruby from here. In this case, it was Ruby 1.8.1.
  • Extracted it to the desktop.
  • Opened the terminal. Entered the following incantations:
    [iBook:~] alan% cd ~/Desktop/ruby-1.8.1/
    [iBook:~/Desktop/ruby-1.8.1] alan% ./configure
    [iBook:~/Desktop/ruby-1.8.1] alan% make
    [iBook:~/Desktop/ruby-1.8.1] alan% sudo make install
    This builds and installs Ruby, luckily to a location other than Apple’s default install.
  • Now we need to move the Apple version of Ruby and effectively (through a symlink) put our new one there instead. Thanks to Jason for the following:
    [iBook:~/Desktop/ruby-1.8.1] alan% sudo mv /usr/bin/ruby /usr/bin/ruby-apple
    [iBook:~/Desktop/ruby-1.8.1] alan% sudo ln -s /usr/local/bin/ruby /usr/bin//ruby

All sorted now:
[iBook:~] alan% ruby -v ruby 1.8.1 (2003-12-25) [powerpc-darwin]

But now when I tried to run Instiki, I kept getting “stack level too deep” errors. Some googling eventually picked up this page which suggested adding the line “ulimit -s 8192” to the end of a file called /etc/rc.common would solve the issue. This it did.

Comments