Wednesday, May 16, 2012

Compiling Ruby on Rails on PowerPC

I had need of a Rails development environment but was low on options. So I pulled out an old Mac Mini running OS X 10.5.8. I downloaded Xcode 3.1.4 from the Apple Developer site.  I think 3.1.4 is the last version of Xcode Apple released for 10.5

RubyonRails.org does not offer a pre-compiled version for PowerPC so I had to download the source for Ruby and compile it. Compiling Ruby 1.8.6 went without incident. I then installed Gem 1.8.24.

When I ran "/usr/local/bin/ruby setup.rb" I received the following message:
     "It seems your ruby installation is missing psych (for VAML output). To eliminate this warning, please install libyaml and reinstall your ruby."

Since it is just a warning, I decided to proceed rather than track down the libyaml library. But when I ran "gem install rails" I received the following message:
     "ERROR: While executing gem ... (Gem::RemoteSourceException) HTTP Response 302 fetching http://gems.rubyforge.org/yaml"

SupportSages had the fix to my issue.  Following their article I did the following:
     1) "gem install rubygems-update --source http://production.s3.rubygems.org/"
     2) "gem update --system --source http://production.s3.rubygems.org/"
     3) "gem sources -a http://production.s3.rubygems.org/"

My next stumbling block was when I tried to install rails a second time. When I ran "gem install rails" again I recieved the following error:
     "ERROR: Error installing rails: activesupport requires Ruby version >= 1.8.7"

[UPDATE 1]

abaird had a solution that worked for me. His solution is meant for Windows, not for PowerPC but it gave me a clue.  So I did a little research and it looks like activesupport 2.3.14 should meet my needs. So I ran:
     1) "gem install activesupport -v 2.3.14"

So, we'll see if I have what I need.  At the moment i have the following installed on a PowerPC instance of OS X 10.5.8:
     - "ruby -v" returns "ruby1.8.6 (2009-06-08 patchlevel 369) [universal-darwin9.0]"
     - "rails -v" returns "rails 1.2.6"

[UPDATE 2]

The normal "rails server" command did not start my default rails app.  After creating the initial app, I had to run "./scripts/server" to load it. I will need to remember to add that command to the server startup scripts.