Rails on a Mac – 1-2-3 noobie guide

Warning! This is not a full-blown tutorial, rather a quick step-by-step intro on what you have to do to run Rails on your Mac, if you are a noobie who just heard of Rails and wants to have it running on his computer ASAP:

  • Step 1 – Get Rails – Rumours say that in the upcoming OS X version – Leopard, Rails will be included by default. If you are on a previous version, though – such as Tiger, then no need to despair – somebody thought about people in a hurry and made out a beautiful app. It’s called Locomotive and includes ruby, rails and many useful gems(tiny ruby libraries with extra functionalities).
  • Step 2 – Get MYSQL for the database backend. If you want to install it as a standalone app, then be my guest. It’s a bit complicated and I’ll be talking about this in a future article. Until then, though, there’s a very nice app out there that has it all: it’s called MAMP (as in Mac, Apache, Mysql, Php) and it’s free. It comes with PhpMyAdmin as well to help manage your databases from the browser.
  • Step 3 – Get Started: You should install and start MAMP, and write down the connection settings it shows (server name, port, socket). Then you go to PhpMyAdmin and create a new database; write down the name, user and password. Start Locomotive and select “Create New…” (Command+N). You select the folder where the app will be created, give a name to the app, OK, and you are set – the system creates the rails application folders where you wanted. All it’s left to do is complete the database config file (RAILS_APPLICATION/config/database.yml) with the connection settings you found out from MAMP – remember to input the server name, database name, user name and the socket value (socket:/path/to/your/mysql.sock) .

development:
adapter: mysql
database: myapp_development
username: root
password: root
socket: /Applications/MAMP/tmp/mysql/mysql.sock
host: localhost

Here you are now! Your Rails application is ready to be developed on your Mac. Go get a good Ruby on Rails tutorial and start rolling!


Similar Posts:

0 Comments

Leave a Reply

Your email address will not be published.