Least intrusive way to install Ruby 1.9 on a borrowed MacBook? I need to use Ruby 1.9 for a programming test, and I'll be borrowing my dad's MacBook Air to do so. He's running OSX 10.7.5 and has Ruby 1.8.7

What's the least "invasive" way to install a newer version of Ruby on his machine. Do I have to install XCode? Do I have to install RVM? Would homebrew be useful for this? If so, is it relatively simple to remove them once I'm done? I'd like to return it "clean" and avoid making any unnecessary changes to his system. It would be ideal if I could undo/uninstall any changes I do make.

Thanks for your help!
The problem is that there aren't any builds for Ruby for OS X, so you'll have to at least install the Command Line Tools for Xcode to be able to build it. But once you've done that, you might as well use any of Homebrew, RVM or rbenv to install Ruby, rather than building it yourself.

I don't think there's any major difference in terms of how easy it is to remove either of these tools, since they were all designed to be standalone and as little intrusive as possible. In fact, RVM and rbenv live in one folder only.

The choice is yours.



With Homebrew

I would say the easiest way of getting Ruby is through Homebrew. Note that Homebrew has Ruby 2.0.0 as of writing this answer, so you won't get 1.9.3 through it.

ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"
brew install ruby


Homebrew and everything it installs lives in /usr/local. You can use this gist to remove it completely – just copy and paste it to a Terminal. Although I would say having Homebrew on a Mac is never a bad idea, which is the reason I'd recommend this over the other methods.



With RVM

RVM is a little more intrusive in the way it interoperates with your shell, but if you're going to remove it after, then you shouldn't worry about it. 

Install RVM by following the instructions. For 1.9.3, you then just need:

rvm install 1.9.3


Note that in order to use RVM you would have to change your shell's configuration file (.bash_profile) as well, so remember to clean that up afterwards. Apart from that, RVM lives in ~/.rvm, and can be uninstalled with rvm implode.



With rbenv

rbenv is a competitor to RVM, and does the same thing. Except that if you want to install Rubies you need ruby-build as a plugin.

Follow its installation guide and once you're done, use rbenv install 1.9.3-p392 for the latest 1.9.3 patchlevel, for example.

To remove rbenv, you only have to delete ~/.rbenv and remove the line that loads it from ~/.bash_profile.