This blog is gonna talk about setting up Ruby, RubyGems, SVN, Git, Rails and MySQL for Snow Leopard. There’s a few other articles that go really in depth with setting up custom server configurations for Snow Leopard, but I found them to be doing more than I need for my personal development ( here ).
In order to get started you’ll have to have Snow Leopard installed, along with XCode (which includes X11). If you don’t install XCode you’ll get an error trying to install things with MacPorts.
Disclaimer: This setup worked for me twice, once on a MBP and once on a 27” iMac i5. I can’t guarantee it’ll work for you. If you run into issues, feel free to leave a comment, but I can’t promise I’ll know the answer.
I’ve setup two different Snow Leopard computers in the past couple days to do this, and I’ve compiled some notes on what worked for me.
To start off, install MacPorts j following their instructions.
If you’re like me, you use Bash as your default shell, so add this
to your
~/.profile
1 2 3 |
|
Chances are, if you’re using Snow Leopard, you’re running 64-bit apps and you have a chip that supports
64-bit architecture. If it does, you can force MacPorts to install apps with 64-bit architecture.
Open up
/opt/local/etc/macports/macports.conf
And change the “build_arch” setting (around line 59) to
x86_64.
Once that’s done, you’re ready to install Ruby.
1
|
|
It’ll take awhile, so go grab a cup of coffee or something while you wait. Once that’s done, running
which ruby
should show
/opt/local/bin/ruby
And running
ruby -v
should show
ruby 1.8.7 (2009-06-12 patchlevel 174) [i686-darwin10]
Next step is rubygems
1
|
|
After that is SVN and Git
1 2 |
|
Next up is MySQL. At the time of writing this, no package for Mac OS 10.6 has been released. So download the 10.5 x86_64 package from here .
Install both packages and the PrefPane (for some reason the pref pane is still 32-bit so it’ll ask you to restart System Preferences every time you use it).
In order to access MySQL from the command line, add this to your
~/.profile
1
|
|
Then run the following in order to refresh your shell.
1
|
|
After installing Rails, you need to install the MySQL adapter gem:
1
|
|
That particular command will tell it to instal the x86_64 version of the gem, and points it to your mysql config files.
Lastly, install Rails. This will install about 8 different gems, and take a few minutes.
1
|
|
Afterwards, you can test this all by running:
1 2 3 4 |
|
And browse to http://localhost:3000 .
Bonus:
If you’re using
sqlite3
, then run this command to get it to install.
1
|
|