Make Locomotive use MAMP’s MySQL install

ADVERTISEMENT

Locomotive is a standalone, all-in-one package of Ruby on Rails for Mac OS X. Instead of downloading source, compiling and installing various packages (Ruby, RubyGems, Rails), you can simply download the Locomotive app and start developing Rails software.

Only it isn’t quite easy.

SQLite3 is the default database for Rails 2, so you have to manually download and install MySQL. Whoops, there goes Locomotive’s standalone promise.

If you are a designer/developer, chances are you use a local server setup to develop and test code before deploying them on production servers. MAMP is another standalone package that bundles PHP, MySQL and Apache in an easy-to-use package. If you have MAMP on your Mac, then you can configure Locomotive to use the MySQL installation of MAMP.

ADVERTISEMENT

Configure Locomotive to use MAMP’s MySQL install

Two easy steps will ensure that your Rails applications can use MAMP’s MySQL. Unfortunately, one of these steps have to be done for each of your Rails applications, the other two are system-wide changes.

Force Locomotive to use MAMP MySQL serverStep 1
Open Locomotive Preferences and add to your “Additional Path” :

/Applications/MAMP/db/mysql/

Step 2
In the database.yml file (in config folder) for your Rails app, add the line below for your development database:

socket: /Applications/MAMP/tmp/mysql/mysql.sock

uby on Rails Locomotive MySQL MAMP

Bonus tip: If you are not comfortable messing with the command line (more so because our tweak to use MAMP’s MySQL introduces more complexity to the commands used), use a database management software to create, edit and delete MySQL databases. I use Sequel Pro.

Discussion

Comments are closed.