Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

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!

share|improve this question
    
You could also use a virtual machine, install ruby there, and once you're done, just delete it. –  houbysoft May 14 '13 at 1:53
add comment

1 Answer

up vote 4 down vote accepted

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.

share|improve this answer
    
Huge thanks, that's exactly the information (and interpretation) I needed! Also, "intrusive" is precisely the word I was looking for when I said "invasive". Kudos :) –  ivan May 11 '13 at 20:26
    
Old question, but I agree with this answer, except I think OSX does have a system version of ruby, but you need Xcode to run command line tools to make new versions. brew (homebrew) is the easiest way to install/update, rbenv allows you to use different versions of ruby w/o affecting other applications. You can assign a particular ruby version locally (directory level), or user-globally (setting stored in ~/.rbenv in home directory), or across shells using environment settings. Which makes it non-invasive. –  Newtons Revenge Jan 25 at 22:25
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.