Screencast: Setting up under Mac OS/X
NOTE: Rails 2.3.3 only: Note specification of version number in gem install below; for more information, see https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/3144-undefined-method-for-string-ror-234
If you intend to watch the screencast, I’d suggest that you print out this page and follow along. To watch, click: http://e168f09.plugh.org/extras/screencasts/macosx-setup/
NOTE: I recorded this in the new Camtasia for the Mac, and it seems to me that the resolution should be better. It’s somewhat readable in full-screen mode (click the icon at the right of the screencast controller). I’ll see if I can improve this.
Another NOTE: The install takes awhile: The build from source may take 10 minutes, and the gem install may take another 5 minutes: I’ve cut the tedious bits from the screencast.
LAST MINUTE NOTE: We are additionally requiring Git. The easiest way to get Git onto a Mac is to use this installer: http://code.google.com/p/git-osx-installer/
On a completely up-to-date Mac with OS/X 10.5 (Leopard), the Ruby and Rails versions are as follows:
ruby 1.8.6 (2008-08-11 patchlevel 287) universal-darwin9.0
Rails 1.2.6
So we need to update both of these. Let’s do it in such a way that you can run your old Ruby and Rails if need be.
1. [Not shown in screencast.] Download and install XCode (provides compiler, etc.) from
http://developer.apple.com/technology/Xcode.html
I used “XCode for Mac-only development.”
You will have to register with Apple Developer Connection (ADC) if you haven’t before.
After clicking through the link above, and logging into ADC, download the link “Xcode 3.1.3 Developer DVD (Disk Image).”
Once you’ve downloaded the package, you should see a window with an icon marked XCodeTools.mpkg – double-click and install.
2. Follow the instructions here (NOTE: slightly different URL below for downloading the most recent version of the ruby_switcher):
For the curl command (to download the script), use this URL to get the latest version, e.g.,
curl -O -L http://github.com/relevance/etc/raw/master/bash/ruby_switcher.sh
The curl command will download the script to your home directory. I recommend creating a bin directory (if you don’t already have one) and moving the script there, e.g.,
mkdir bin mv ruby_switcher.sh bin/
Then at the end of your .bash_profile in your home directory, you would want:
source ~/bin/ruby_switcher.sh
From your root directory, to make sure that your environment has up-to-date aliases from the script, type
source ~/bin/ruby_switcher.sh
3. Assuming all that is done properly, type
install_ruby_191
4. To verify:
ruby -v
You should see:
ruby 1.9.1p243 (2009-07-16 revision 24175) i386-darwin9.8.0
5. One last step. Edit bin/ruby_switcher.sh again, and edit the last line. Change it from “use_leopard_version” to “use_ruby_191″
6. That should be it for Ruby. Now when you start a terminal session, your Ruby will be 1.9.1.
7. Sqlite3: It’s already set up on the Mac for version 3.4, which will be ok.
8. Rails and the Sqlite3 gem:
gem install rails -v 2.3.3 gem install sqlite3-ruby
NOTE: Some of you who have used RubyGems are wondering why I don’t have to type “sudo gem install” — or why the Ruby install didn’t prompt for a sudo password. It’s because this script installs everything locally for your non-privileged user.
9. Done. To verify:
sqlite3 -version rails -v
I bit the bullet and did a full clean reinstall of Snow Leopard. Installed XCode 3.2 and the iPhone SDK, then followed the instructions outlined here, and voila, everything installs just fine. I guess for major versions and especially when you are developing, it's best to do a clean install. thanks for your input!
@john
Hi John,
i'll be also interested in how you are fixing the Text Mate issue. Right now, it's not directing to my local user install, and hence i'm defaulting to 1.8.7 when running from inside TextMate.
None of this is giving me a lot of confidence that I can or should install Snow Leopard, especially since I'd be installing it over Leopard rather than 'clean'. I guess I should stay with what I have until the class is over....