This post originated from an RSS feed registered with Ruby Buzz
by Sam Aaron.
Original Post: Rubinius on OS X
Feed Title: Communicatively Speaking
Feed URL: http://sam.aaron.name/feed/atom.xml
Feed Description: Sam Aaron's blog. Here you'll find interesting discussions on matters such as communicative programming, domain specific languages and music.
OK, so you saw Evan Phoenix’s talk at RailsConf in Berlin on Rubinius, and you just had to get a piece of that action. After all, there’s Ruby everywhichway, the error reporting is both beautiful and useful, it’s already mostly faster than mri1, and the optimisation process has hardly started. Oh, let’s also not forget that mri is at the end of its life-cycle; there’s very little optimisation to be squeezed out of it now. It’s time to move on.
So let’s get installing already. Like pretty much every Ruby/Rails hacker out there I’m guessing you’re using a mac. If you’re not, there are some generic instructions on the Rubinius wiki for your compiling pleasure.
If you are a Ruby or Rails hacker, you’ll already have most of the prerequisites installed. That’s nice; you might be able to skip some of these steps. I use macports to make installing this stuff a lot less of a headache. I’m assuming you do too. If you don’t, you need to grab the latest copy of the Xcode developer tools, and then install macports. I’ll stick around and be here whilst you go do that. Once you’ve grabbed it, make sure it’s in tip-top condition:
sudo port selfupdate
Rightio, let’s get started. First up, you need to grab a copy of Git. Rubinius is one of the first Ruby community projects to pioneer the use of Git. Let this be a life-changing golden opportunity for you to check it out. Ah, get the pun: ‘check it out’, nevermind.
sudo port install git-core
Now is a good opportunity to introduce yourself to git:
Smashing. Now you can grab the latest version of the Rubinius source. Head to your developer directory, and utter the following mantra:
git clone http://git.rubini.us/code rubinius
Whilst git performs its getting and walking magic, you might want to take a break and have a cup of tea. I recommend a mix of assam and darjeeling leaves brewed with just-boiled-freshly-drawn water. Oh, and don’t forget the milk!
Ok, now you should install Ruby, RubyGems, and Rake. You probably have these already.
sudo port install ruby rb-rubygems
sudo gem install rake
Next, grab a few things that Rubinius needs to help it compile:
sudo port install bison glib2 libtool
Things are going swimmingly, don’t you think, and we’re only one command away from a working Rubinius executable:
cd rubinius ; rake build
Ok, that was cheating – it was two commands. Don’t complain however, Rubinius has arrived. Witness:
shotgun/rubinius -e "puts 'Rubinius Rocks\!'"
Rubinius also ships with an irb clone2. Simply fire up:
shotgun/rubinius
and you’re away. Remember I said that the error reporting was nice. See for yourself:
Have fun :-) Oh, and pop by #rubinius on freenode for a guaranteed top time.
1 MRI is an abbreviation for Matz’s Ruby Interpreter. Which is pretty much guaranteed to be the Ruby implementation you’re using now.