You know how they say you should learn a new language every year? Well, I’m woefully behind on that. I’m hoping this will be a year to finally get my head around Objective-C and Ruby to make up for lost time.
So anyway, I sat down tonight to install Ruby and actually do something. I didn’t get to the “do something” part. But here’s how I got ruby to report the latest version (1.9.3) instead of what it came with (1.8.7).
- RubyGems – apparently this is like NuGet (a package management system for software libraries and their dependencies), if you are coming from the .NET developer world like me.
- RVM – “Ruby Version Manager.” Apparently this is how all the cool kids install Ruby. I shunned this advice I found in my early Googling, trying to use sudo and RubyGems to update it. Which just yielded cryptic errors about missing header files.
- Homebrew – You end up needing this for an obscure SSL management library. All will become clear soon. This has nothing to do with Wii Homebrew, which I love.
So first off…holy cow. I see why there’s a kickstarter project that already has almost double its asking pledge to make this easy.
Alright…now that that’s out of the way.
I’ll spare you all the dead ends I went down (and oh, there were many). Remember…this is so when I type ‘ruby -v’ I see 1.9.3 (actually, to be clear, 1.9.3p194) instead of 1.8.7 out of the box with Lion. Here’s what ended up working:
- Install Xcode
- Install the Command Line Tools in Xcode Preferences > Downloads
- Start doing the stuff on this page for RVM. Note that I utterly ignored its warning to read all subsections under RVM. I’ll get to that someday, I promise.
- Now while you were doing step #3, you might’ve said to yourself “pssh. Requirements. Who needs those?” You do. For just the straight Ruby install, it says you need Libksba. Because, of course you do. It’s libksba!
- To actually get Libksba, I found the easiest (for me, only) way to get it to work was using Homebrew. This appears to be some sort of package / dependency manager distinct from RubyGems.
- Run `brew doctor` and do what it says (my only deviation was not remediating /usr/local permissions, but I did switch the Xcode path). If you did steps #1 and #2 here, some of these will be taken care of. For the rest, this article helped me out a lot.
- You’re almost home! Now type `rvm install 1.9.3` and have a drink. Because, man, you earned it.