In the past it has been quite difficult to get RubyOnRails running on you Mac OS X but I just found out that all the pain has vanished. Especially the setup guides on the rubyonrails.org website are a little confusing because most of them are outdated. So if any of you are still interested how to set everything up, read on – I’ve written a small guide.
What you need
No matter what operating system you are using there is a minimum set of tools you need to have installed and ready to run:
- Ruby
- The rails framework
- Mysql
- A GUI database manager like phpMyAdmin
- An editor like Eclipse or TextMate
Mac OS X
Simple Setup
The setup on Mac OS X is pretty simple. You can download Locomotive which is an all-in-one RubyOnRails package. It gives you an entire framework with everything included to run RubyOnRails on your machine. There are even different bundles available to extend the features of rails.
The database part is simple too, in theory. There is a package called MAMP which provides an Apache webserver and a MySQL server. This package also includes phpMyAdmin which enables you to manage the database with a GUI web front-end.
Another way would be to install MySQL by downloading the .dmg file from the MySQL website and to install it afterwards. The standard package is all you need. This package includes a system preferences panel that allows you to start and stop the mysql server with a button. Furthermore I would recommend YourSQL or phpMyAdmin to manage the databases.
Setup for Pro’s
The better way, instead of using these prepackaged solutions, would be installing everything by hand. Therefore you need to download and install the Apple Developer Tools (also known as Xcode). You need an Apple ID / Account to download Xcode. Then you need MacPorts (formerly known as darwinports). MacPorts is a collection of unix ports. These allow you to compile almost any unix tool that is not natively available for Mac OS X. To get the MacPorts on your mac go to the MacPorts download page and get the .dmg file (NOTE: I’m not sure if these .dmg files work on Intel Macs, let me know if you checked that). Unpack and install it. There is guide on the MacPorts website that gives you additional instructions for setting everything up. Afterwards read through the quick guide to learn the basic concepts of MacPorts. If you feel ready, continue with installing everything else.
First of all there is a RubyOnRails port. By installing this you get ruby, the rails framework and any other dependency you may need. You can install it by opening your Terminal.app. Then type in ‘sudo port install rb-rails’ and the magic should begin. Basically this command downloads all the necessary files, compiles and installs them in the right location.
After that its time for MySQL. Type ‘sudo port install mysql5’ to get the latest version of MySQL5 compiled for your very system. This should take a couple of minutes. Afterwards you can start the mysql daemon by invoking ‘sudo /opt/local/mysqld_safe5’ in your terminal.
If you choose to install MySQL with the .dmg mentioned in the simple setup you can start it with the preference pane or by typing ‘sudo /usr/local/mysql/mysqld_safe’.
Documentation
- Ruby Guide with comics and a lots of fun: Why’s (Poignant) Guide to Ruby
- Ruby Quickstart: Ruby in 20 minutes
- Ruby Language Documentation: Ruby Documentation
- Even more documentation: http://ruby-doc.org/
- Ruby API Reference Ruby Core
- Rails API Reference, Tutorials, How-To’s: Rails Documentation Page
- Rails screencasts showing its incredible features: Screencasts