Ian McShane Rotating Header Image

Ruby on Rails, mySQL, Mongrel and OS X Leopard

For the majority of my RoR development, i’ve used a Windows machine running Instant Rails. Apparently, the Mac is the so-called “favoured platform” for Ruby on Rails development so i’ve been looking forward to getting rolling with this on my shiny Macbook. However, i’ve spent a couple of days scouring Google and Groups trying to find the optimum way to get everything set up and running. There isn’t much information where Leopard is concerned, most of the posts and articles are geared toward Tiger and involve building and compiling Ruby from source with XCode.

Well, i’ve got mine environment up and running so hopefully this will save someone else a bit of time. Of course, that does assume that i’ve done this all in the correct manner! Any corrections or updates welcome! šŸ™‚

Firstly, it’s quite well documented that OS X 10.5 comes with Ruby, Rails and all kinds of other goodness ready to go out of the box. You can get a rails template app built and served by entering three lines into Terminal:

rails myWickedAceApp

cd myWickedAceApp

ruby scripts/server

Get your browser to http://localhost:3000 and you’ll see the Welcome Aboard page..


Pretty neat as apparently there were some problems with prior versions of OS X having a version of Ruby that was in some way incompatible with Rails.
You’ll need to add some code behind this template or all you have is a nice page with some AJAX in there for fun! You’ll probably also need a database application of some sorts, such as mySQL (other database apps may be available, YMMV).

Google brings up all kinds of problems with the OS X dmg package of mySQL 5.0.45, there’s even a defect logged for it. (First bugged back in June but closed because mySQL didn’t have access to the Apple Developers programme!)
I have to say though, my installation of it worked fine. I installed both mySQL and the StartUp packages, ran “chmod -R 777 /usr/local/mysql” and rebooted.

mySQL on Leopard

No problems there.

In the current absence of a SVN client (I haven’t gotten around to sorting that out yet, i’m sure there is one around) I quickly grabbed a copy of the production code and imported a DB dump locally. (“mysql %DATABASE% < database.bak”)

Again, worked straight off of the bat. So, currently, I can’t see what the fuss is about. Nor why there aren’t any quick start guides for Leopard.

(I’ll re-iterate, i’m still pretty new to OS X so I may well have missed/cocked up something here)

[tags]Switch To Mac, OS X, Ruby on Rails, Macbook, mySQL, Leopard[/tags]

One Comment

  1. John says:

    it seems to be
    ruby script/server… or my system is *`2&* up

    kind regards

Leave a Reply

Your email address will not be published. Required fields are marked *