How to replace Ruby 1.8.7 with Ruby 1.9.2 on Mac OS 10.6.4?

Posted on 2010-09-04
Last Modified: 2012-06-27
I have a Mac OS X with Snow Leopard 10.6.4 that has Ruby 1.8.7 preinstalled from the factory.  I have zero experience with Terminal and programming, but I am trying to learn Ruby and want to upgrade to the latest version 1.9.2.  I have tried various methods in books, on the web, Locomotive, etc. and I just cannot figure out how to get it installed and configured as the default.  The resources on the web for this keep losing me at various technical details.  Can anyone provide detailed, step-by-step instructions for how to do this for an absolute beginner?  I would like to have all the ancillary programs like Rails, RadRails, gems, etc. as well.  Thanks very much for any assistance.

P.S. On the current version, I also cannot get Shebang, the Tk toolkit (which is factory installed), or the "sprintf" command to work.

P.P.S.  How can I change the default directory that Terminal looks for programs in?  Right now it's under my user root directory but I don't know how to change to another default folder I'd rather use.
Question by:SBR210
  • 4
  • 2
LVL 14

Accepted Solution

wesgarrison earned 250 total points
ID: 33605135
Use rvm:

You can install multiple ruby versions and they all stay nice and separate.  You don't have to mess with your system ruby, in case there is something that OS X uses it for.

You might also look into cinderalla:

It includes rvm along with everything else you need to get going on rails development (databases, gems, git, etc.)

I just used it on a fresh install and it was great, so I highly recommend it.
LVL 12

Assisted Solution

JESii earned 250 total points
ID: 33606554
Re: your PPS and default directories, the system automatically starts your terminal session in your "home" directory, something like

You can change to a new directory with the 'cd' command (for change directory), such as
    cd /Users/JESii/Documents

If you really want to automatically do this when you start a Terminal session, then you'll have to learn a bit about bash, which is what's running in Terminal, and all the commands that are available there.

If you know how to edit a file in your home directory, then create a file called .bashrc [the leading dot is important], put one line in it that contains the cd command with the directory where you want to go, save the file, exit Terminal, and start Terminal again -- you should be automatically switched to that directory.

check out for more information about bash

Author Comment

ID: 33642251
@ wesgarrison
Thanks very much for the advice.  I decided to try RVM since the Cinderella seems to default install an older version of Ruby, and I'm not sure of the method to designate the latest version...

So I followed the instructions and downloaded RVM via Curl, and this was the result I got (my command in the first line):

iMac:~ sbriffe$ curl
#!/usr/bin/env bash

if [[ -f /etc/rvmrc ]] ; then source /etc/rvmrc ; fi
if [[ -f "$HOME/.rvmrc" ]] ; then source "$HOME/.rvmrc" ; fi
mkdir -p $rvm_path/src/
builtin cd $rvm_path/src
rm -rf ./rvm/
git clone git://
builtin cd rvm
bash ./scripts/install

So from this, I assume the installation was successful?  How can I check this?  Also, I have been studying the post-installation instructions (reproduced below) and I don't understand how to do any of it.  I'm really a complete novice with this stuff, sorry if these are dumb questions.  How can I confirm that Ruby 1.9.2 has been installed correctly, and if not, how do I complete the installation?  How do I set the default Ruby as 1.9.2 rather than the factory's 1.8.7?  Thanks again for the help, it's very much appreciated.

P.S. What is the three-dot symbol in these instructions below represent?  I tried entering several of the commands in the instructions below at my Bash prompt in Terminal and it resulted in errors.

The first time you install RVM, you must put the following line into your profile at the very end, after all path loads etc:
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"  # This loads RVM into a shell session.

Doing so ensures rvm is loaded as a function (versus as a binary), ensuring commands such as rvm use work as expected. Please note that you can confirm this worked correctly by opening a new shell and running:
¿ type rvm | head -n1

If this was performed correctly, you should see:
rvm is a function

Next, you can manually load the new code into your current shell and start using RVM ! w00t!
¿ source ~/.rvm/scripts/rvm

Be sure to install any dependencies for your operating system by running:
¿ rvm notes

The following script will boostrap git + RVM assuming that you have curl & sudo installed. It will also install (last line) several common rubies.
#!/usr/bin/env bash

# Install git
mkdir -p $HOME/.rvm/src && cd $HOME/.rvm/src && version=
curl -O$version.tar.gz; tar xzf git-$version.tar.gz
cd git-$version && ./configure --prefix=/usr/local && make && sudo make install

# Install RVM
bash < <( curl )

# Install some rubies
source "$HOME/.rvm/scripts/rvm"
rvm install ree,1.9.2-head,jruby

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.


Author Comment

ID: 33642274

Thanks very much for the help, the Bash tutorial looks really helpful, although it's still too advance for me to make a lot of use of it.  I've started studying Ruby and HTML but I think I'm missing a lot of foundational knowledge.  Are there any books or resources that you've found helpful that could get me up to speed on this stuff?  I've programmed a little in Basic before and recently read some beginning programming type books, but they haven't covered this gap in knowledge and I seem to be out of my depth from the beginning here.  Thanks again.

Author Comment

ID: 33642443

By the way, I tried the procedure at which is also listed below for switching the default Ruby to the newest version:

"Setting the default Ruby

If you would like to make one specific Ruby be the default ruby that is selected when you open a new terminal shell simply use the --default flag:

¿ rvm --default ruby-head

¿ ruby -v  #=> ruby 1.9.2dev (2010-02-25 trunk 26759) [x86_64-darwin10.2.0]"

but I got the following result instead:

-bash: rvm: command not found
LVL 12

Expert Comment

ID: 33642452
Sure... there's a lot to learn, but you can get there.

Go here: for a good list of books, from Absolute Beginner to advanced.

I like the O'Reilly book "The Ruby Programming Language" andThe Ruby Way (2nd Edition) by Obi Fernandez. There's also "The Well-Grounded Rubyist" by Apress which I like.

Author Comment

ID: 33645144
Thanks again to both of you - I was able to finally get Ruby installed using the Hivelogic instructions (  I am still getting a configuration error trying to run the .config command to install MySql but that will be the topic of a different post if I can't fix it.

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you are using Mac OS X and have a large number of login items set up in accounts, under system preferences, you may find that your computer is sluggish and unresponsive during startup until everything is done launching. Another problem that a…
Do you come here a lot? Are you lazy like me and don't want to go through the "trouble" of having to click your Dock's Safari icon and then having to click your Experts Exchange Favorites bookmark to get here? Well then this article is for you.
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question