views:

705

answers:

6

I am setting up a new Macbook as a rails development machine. Till now, I always installed ruby, MySQL, etc. through MacPorts, because I don't want to be dependent on the system version of ruby. But with stuff like Homebrew and rvm (no link because of spam prevention) popping up, is there a better recommended way of setting up ruby for rails development on OS X?

+1  A: 

Just run

gem update rails

and you'll get Rails on Snow Leopard. More info: http://rubyonrails.org/download

MySQL you should also not install from ports. I've got problems with it in Snow Leopard due to 32 vs 64 bit issues. I've installed the package provided at http://mysql.com and then I installed the mysql gem.

J. Pablo Fernández
A: 
gem update rails

... and don't forget to update Ruby

marcgg
+3  A: 
John Topley
A: 

I use MacPorts.

These are the commands I ran. http://gist.github.com/191020

I installed Git, Subversion, Mercurial, ImageMagick and some other stuff as well.

TK
A: 

There are only a handful of valid reasons to not use Passenger and their "Enterprise" version of Ruby.

Azeem.Butt
For deployment, I completely agree. But I don't really see a reason to run REE in development. Passenger is a matter of taste. It's my preferred deployment server, but so far I've usually still been using Mongrel during development.
Mirko Froehlich
A: 

I pretty much use the same approach as J. Pablo Fernandez recommended. Use gem to upgrade Rails etc., install MySQL from the official installation package, and then install the MySQL gem. Note that you'll want to grab the 64-bit version of MySQL, and then use the following magic incantation to install the gem:

sudo env ARCHFLAGS="-arch x86_64" gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config

For other dependencies (and tools like Git) I still use MacPorts. I haven't really had any problems with it, although I don't think I've had to install ImageMagick since I installed Snow Leopard, so I don't have any first hand experience about this. I've been curious about Homebrew as well. It sounds like a very clean solution, so it probably wouldn't hurt to check it out.

Last not least, I've come to rely on rvm to easily install and toggle between multiple versions of Ruby. This allows me to use 1.8.7 for my own apps, 1.8.6 for client apps that require it, 1.9 or JRuby if I want to play around with it, etc. Highly recommended!

Mirko Froehlich