Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


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

Posted on 2010-09-04
Medium Priority
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
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
LVL 14

Accepted Solution

wesgarrison earned 1000 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 1000 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 http://www.hypexr.org/bash_tutorial.php 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 http://rvm.beginrescueend.com/releases/rvm-install-head
#!/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://github.com/wayneeseguin/rvm.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 http://kernel.org/pub/software/scm/git/git-$version.tar.gz; tar xzf git-$version.tar.gz
cd git-$version && ./configure --prefix=/usr/local && make && sudo make install

# Install RVM
bash < <( curl http://rvm.beginrescueend.com/releases/rvm-install-head )

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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.


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 http://rvm.beginrescueend.com/rubies/default/ 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: http://programmingzen.com/ruby-and-rails-recommended-books/ 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 (http://hivelogic.com/articles/compiling-ruby-rubygems-and-rails-on-snow-leopard).  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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

The /etc/authorization file in Mac OS X 10.x can be used to control access to the various panes of the System Preferences amongst other things. It’s used by some of us Mac Sys Admin’s to give Standard Users access to System Prefs panes that only adm…
We could spend the next millennium discussing the differences of the Mac and Windows platforms. The next century will continue to have fanatics on both side of the equation and neither side will win the war. However, that’s not why we are here. W…
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 …
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

618 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