Tuesday 2007/07/10
3:02 PM

Categories: Flash/Actionscript, OS X, Ruby/Rails, TextMate, Web Dev

Locomotive on Rails, with MAMP as a Caboose

Update 2008-07-14: Looks like Locomotive is no longer being distributed, since OS X 10.5 now ships with Ruby on Rails installed.

Pretty soon we’ll have a framework called “ChooChoo” just to take this metaphor to its logical demise. I’ve just started dipping my toe into Ruby on Rails, and have found it relatively easy to get up and running on OS X. I’ve been using a combination of MAMP and Locomotive. MAMP, of course, is the Macintosh/Apache/MySQL/PHP app that takes the pain out of setting up those respective components and allows you to focus on writing code. Locomotive is similar in that it takes care of setting up your Rails environment so you can start developing. In this situation MAMP is only being used for the MySQL component. I have a feeling Locomotive will eventually have this as part of its package, making things even easier.

There were two things I needed to do to get my setup working smoothly:

  • Tell Locomotive to use MAMP for MySQL. I did this by going to Locomotive > Preferences > Terminal and putting “/Applications/MAMP/db/mysql/” in the Additional Paths field.
  • From this tip at aralbakan.com: adding a socket definition to my database config file – “socket: /Applications/MAMP/tmp/mysql/mysql.sock”

I like that you can open up a terminal session from Locomotive and it’ll set the context to be the Locomotive Rails environment – this way I don’t have to mess with setting up my PATH to point to the Locomotive’s Ruby instead of the default OS X one.

TextMate, of course, makes working with Ruby/Rails quite easy. I’ve been spending some time in Flex Builder lately, and coming back to the TextMate environment is a breath of cleaner, simpler air.

This was the tutorial I started out with: Using Ruby on Rails for Web Development on Mac OS X.

I also ran through the Merb/AIR tutorial here: Merb on AIR – Drag and Drop Multiple File Upload. Merb isn’t Rails per se, but the example illustrates the way that Ruby apps can be used with AIR/Flash applications.


Responses


Kevin

Tuesday 2007/08/28 1:04 AM

Thanks for the tip. I\’m new to the Mac and had downloaded Locomotive but was having a bit of a time getitng it setup. I had started a web app before I switched to the Mac (in Feb of this year) and was having trouble getting it setup and this short post helped me.


Philip

Thursday 2007/11/01 10:38 AM

wow, thanks for the post. saved me from a few more hours of head banging.


Ben

Wednesday 2008/04/30 6:44 PM

Thanks for the tip on setting the socket in the database.yml file. That saved a ton of time!