My Company's Advertisement

Getting Ruby on Rails Working with MAMP (Mac)

I just spent about two hours trying to set up Ruby on Rails on my Mac with MAMP. Here’s a quick and dirty of how to do it for those of you who don’t feel like going crazy.

Follow the installation steps for RoR here: http://wiki.rubyonrails.org/getting-started/installation/mac

Edit your MAMP MySQL installation using the steps provided on this website: http://boonedocks.net/mike/archives/175-MAMP-and-the-Ruby-MySQL-Gem.html

After you’ve created your first Rails project, locate it on your computer, then go to config/database.yml and enter the following:

development:
 adapter: mysql
 database: XXX_dev
 username: root
 password: root
 timeout: 5000
 socket: /Applications/MAMP/tmp/mysql/mysql.sock

# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
 adapter: mysql
 database: XXX_test
 username: root
 password: root
 timeout: 5000
 socket: /Applications/MAMP/tmp/mysql/mysql.sock

production:
 adapter: mysql
 database: XXX
 username: root
 password: root
 timeout: 5000
 socket: /Applications/MAMP/tmp/mysql/mysql.sock

Finally, follow the steps provided here to create your MySQL DB for the project.

Good luck.

Leave a Reply