Installing rvm and ruby in OSX Mountain Lion

I recently moved into Mountain Lion (OSX 10.8) and the first thing I wanted was to install rvm to be able to get ruby 1.9.3 in the machine and be able to do some development with it, but as usual it was not as easy as it seemed (The joke is on me!) so here are the steps I took to install rvm and ruby 1.9.3 in OSX Mountain Lion.

Install RVM And Ruby On Mac OSX Mountain Lion:

Fast list check:

  • Xcode: Got XCode installed?
  • Xcode CLI: Got the command line XCode tools installed? (not required but they really do help)
  • Mountain Dew: Got Mountain Dew next to you?

Install RVM:

First we install rvm, open a terminal (Applications->Utilities->Terminal) and type one of the next two commands.

bash < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)

OR the next (taken from the rvm homepage)

curl -L https://get.rvm.io | bash -s stable --ruby

The result for the command is

Downloading RVM from wayneeseguin branch master
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   131  100   131    0     0    106      0  0:00:01  0:00:01 --:--:--   168
100 1490k  100 1490k    0     0   179k      0  0:00:08  0:00:08 --:--:--  151k

Installing RVM to /Users/esanchez/.rvm/
    Adding rvm PATH line to /Users/esanchez/.bashrc /Users/esanchez/.zshrc.
    Adding rvm loading line to /Users/esanchez/.bash_profile /Users/esanchez/.zprofile.

# RVM:  Shell scripts enabling management of multiple ruby environments.
# RTFM: https://rvm.io/
# HELP: http://webchat.freenode.net/?channels=rvm (#rvm on irc.freenode.net)
# Cheatsheet: http://cheat.errtheblog.com/s/rvm/
# Screencast: http://screencasts.org/episodes/how-to-use-rvm

# In case of any issues read output of 'rvm requirements' and/or 'rvm notes'

Installation of RVM in /Users/esanchez/.rvm/ is almost complete:

  * To start using RVM you need to run `source /Users/esanchez/.rvm/scripts/rvm`
    in all your open shell windows, in rare cases you need to reopen all shell windows.

# esanchez,
#
#   Thank you for using RVM!
#   I sincerely hope that RVM helps to make your life easier and
#   more enjoyable!!!
#
# ~Wayne

Error Compiling Ruby Version 1.9.2:

Everything is fine, so what is the problem? the problem arised when I tried to compile ruby 1.9.2 and this is the error I got:

ESanchez:~ esanchez$ rvm install 1.9.2
Searching for binary rubies, this might take some time.
No binary rubies available for: osx/10.8/x86_64/ruby-1.9.2-p320.
Continuing with compilation. Please read 'rvm mount' to get more information on binary rubies.
Fetching yaml-0.1.4.tar.gz to /Users/esanchez/.rvm/archives
######################################################################## 100.0%
Extracting yaml to /Users/esanchez/.rvm/src/yaml-0.1.4
Configuring yaml in /Users/esanchez/.rvm/src/yaml-0.1.4.
Compiling yaml in /Users/esanchez/.rvm/src/yaml-0.1.4.
Installing yaml to /Users/esanchez/.rvm/usr
The provided compiler '/usr/bin/gcc' is LLVM based, it is not yet fully supported by ruby and gems, please read `rvm requirements`.
ESanchez:~ esanchez$

We read the error fully and it says: “The provided compiler ‘/usr/bin/gcc’ is LLVM based, it is not yet fully supported by ruby and gems, please read `rvm requirements`.” This gives us a tip on using a different compiler for rvm, so we try using clang as a compiler:

rvm install 1.9.3 --reconfigure --debug -C --enable-pthread --with-gcc=clang

Ruby 1.9.2 Installation Results:

And this is the final result!

ESanchez:~ esanchez$ rvm install 1.9.3 --reconfigure --debug -C --enable-pthread --with-gcc=clang
1.9.3 - install
found compiler: clang
Fetching yaml-0.1.4.tar.gz to /Users/esanchez/.rvm/archives
Fetching: https://rvm.io/src/yaml-0.1.4.tar.gz
Fetch command: curl  -f -L --create-dirs -C - -o yaml-0.1.4.tar.gz
Archive checksum matched, not downloading
Downloaded archive checksum matched.
Extracting yaml to /Users/esanchez/.rvm/src/yaml-0.1.4
[2013-01-31 16:22:45] __rvm_package_extract
__rvm_package_extract ()
{
    rvm_debug __rvm_package_extract:$#: "$@";
    [[ -d "$2" ]] || mkdir -p "$2";
    case "$1" in
        *.zip)
            unzip -q -o "$1" -d "$2"
        ;;
        *.tar.bz2)
            ${rvm_tar_command:-tar} xjf "$1" -C "$2" ${rvm_tar_options:-}
        ;;
        *.tar.gz | *.tgz)
            ${rvm_tar_command:-tar} xzf "$1" -C "$2" ${rvm_tar_options:-}
        ;;
        *)
            return 199
        ;;
    esac
}
current path: /Users/esanchez/.rvm/src
command(3): __rvm_package_extract /Users/esanchez/.rvm/archives/yaml-0.1.4.tar.gz /Users/esanchez/.rvm/src
Configuring yaml in /Users/esanchez/.rvm/src/yaml-0.1.4.
[2013-01-31 16:22:45] ./configure
current path: /Users/esanchez/.rvm/src/yaml-0.1.4
command(5): ./configure --prefix=/Users/esanchez/.rvm/usr --enable-pthread --with-gcc=clang --disable-shared
Compiling yaml in /Users/esanchez/.rvm/src/yaml-0.1.4.
[2013-01-31 16:22:50] make
current path: /Users/esanchez/.rvm/src/yaml-0.1.4
command(1): make
Installing yaml to /Users/esanchez/.rvm/usr
[2013-01-31 16:22:55] make
current path: /Users/esanchez/.rvm/src/yaml-0.1.4
command(2): make install
rvm_configure_flags+=( --with-opt-dir=/Users/esanchez/.rvm/usr )
found compiler: clang
Installing Ruby from source to: /Users/esanchez/.rvm/rubies/ruby-1.9.3-p374, this may take a while depending on your cpu(s)...
ruby-1.9.3-p374 - #downloading ruby-1.9.3-p374, this may take a while depending on your connection...
Fetching: http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p374.tar.bz2
Fetch command: curl  -f -L --create-dirs -C - -o ruby-1.9.3-p374.tar.bz2
No archive, downloading
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 9782k  100 9782k    0     0   322k      0  0:00:30  0:00:30 --:--:--  371k
Downloaded archive checksum matched.
ruby-1.9.3-p374 - #extracting ruby-1.9.3-p374 to /Users/esanchez/.rvm/src/ruby-1.9.3-p374
[2013-01-31 16:23:26] __rvm_package_extract
__rvm_package_extract ()
{
    rvm_debug __rvm_package_extract:$#: "$@";
    [[ -d "$2" ]] || mkdir -p "$2";
    case "$1" in
        *.zip)
            unzip -q -o "$1" -d "$2"
        ;;
        *.tar.bz2)
            ${rvm_tar_command:-tar} xjf "$1" -C "$2" ${rvm_tar_options:-}
        ;;
        *.tar.gz | *.tgz)
            ${rvm_tar_command:-tar} xzf "$1" -C "$2" ${rvm_tar_options:-}
        ;;
        *)
            return 199
        ;;
    esac
}
current path: /Users/esanchez/.rvm/src
command(3): __rvm_package_extract /Users/esanchez/.rvm/archives/ruby-1.9.3-p374.tar.bz2 /Users/esanchez/.rvm/tmp/rvm_src_3725
__rvm_rm_rf already gone: /Users/esanchez/.rvm/src/ruby-1.9.3-p374
ruby-1.9.3-p374 - #extracted to /Users/esanchez/.rvm/src/ruby-1.9.3-p374
Trying patch 'default'.
Patch name 'default'.
All found patches(0): .
ruby-1.9.3-p374 - #configuring
[2013-01-31 16:23:29] ./configure
current path: /Users/esanchez/.rvm/src/ruby-1.9.3-p374
command(7): ./configure --disable-install-doc --prefix=/Users/esanchez/.rvm/rubies/ruby-1.9.3-p374 --enable-pthread --with-gcc=clang --with-opt-dir=/Users/esanchez/.rvm/usr --disable-shared
ruby-1.9.3-p374 - #compiling
[2013-01-31 16:23:54] make
current path: /Users/esanchez/.rvm/src/ruby-1.9.3-p374
command(1): make
__rvm_rm_rf already gone: /Users/esanchez/.rvm/src/ruby-1.9.3-p374/.ext/rdoc
ruby-1.9.3-p374 - #installing
[2013-01-31 16:25:40] make
current path: /Users/esanchez/.rvm/src/ruby-1.9.3-p374
command(2): make install
Running /Users/esanchez/.rvm/hooks/after_use_maglev
Running /Users/esanchez/.rvm/hooks/after_use_maglev
__rvm_rm_rf already gone: /Users/esanchez/.rvm/src/rubygems-1.8.25
Retrieving rubygems-1.8.25
Fetching: http://production.cf.rubygems.org/rubygems/rubygems-1.8.25.tgz
Fetch command: curl  -f -L --create-dirs -C - -o rubygems-1.8.25.tgz
No archive, downloading
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  371k  100  371k    0     0   399k      0 --:--:-- --:--:-- --:--:--  698k
Downloaded archive checksum matched.
Extracting rubygems-1.8.25 ...
[2013-01-31 16:25:45] __rvm_package_extract
__rvm_package_extract ()
{
    rvm_debug __rvm_package_extract:$#: "$@";
    [[ -d "$2" ]] || mkdir -p "$2";
    case "$1" in
        *.zip)
            unzip -q -o "$1" -d "$2"
        ;;
        *.tar.bz2)
            ${rvm_tar_command:-tar} xjf "$1" -C "$2" ${rvm_tar_options:-}
        ;;
        *.tar.gz | *.tgz)
            ${rvm_tar_command:-tar} xzf "$1" -C "$2" ${rvm_tar_options:-}
        ;;
        *)
            return 199
        ;;
    esac
}
current path: /Users/esanchez/.rvm/src/ruby-1.9.3-p374
command(3): __rvm_package_extract /Users/esanchez/.rvm/archives/rubygems-1.8.25.tgz /Users/esanchez/.rvm/src
Removing old Rubygems files...
__rvm_rm_rf already gone: /ubygems.rb
__rvm_rm_rf already gone: /gauntlet_rubygems.rb
__rvm_rm_rf already gone: /rbconfig/
__rvm_rm_rf already gone: /rubygems*
Installing rubygems-1.8.25 for ruby-1.9.3-p374 ...
[2013-01-31 16:25:45] /Users/esanchez/.rvm/rubies/ruby-1.9.3-p374/bin/ruby
current path: /Users/esanchez/.rvm/src/rubygems-1.8.25
command(5): env GEM_PATH=/Users/esanchez/.rvm/gems/ruby-1.9.3-p374:/Users/esanchez/.rvm/gems/ruby-1.9.3-p374@global:/Users/esanchez/.rvm/gems/ruby-1.9.3-p374:/Users/esanchez/.rvm/gems/ruby-1.9.3-p374@global GEM_HOME=/Users/esanchez/.rvm/gems/ruby-1.9.3-p374 /Users/esanchez/.rvm/rubies/ruby-1.9.3-p374/bin/ruby /Users/esanchez/.rvm/src/rubygems-1.8.25/setup.rb
Installation of rubygems completed successfully.
Running /Users/esanchez/.rvm/hooks/after_use_maglev
Saving wrappers to '/Users/esanchez/.rvm/bin'.
[2013-01-31 16:25:45] chmod
current path: /Users/esanchez/.rvm/src/ruby-1.9.3-p374
command(10): chmod +x /Users/esanchez/.rvm/rubies/ruby-1.9.3-p374/bin/erb /Users/esanchez/.rvm/rubies/ruby-1.9.3-p374/bin/gem /Users/esanchez/.rvm/rubies/ruby-1.9.3-p374/bin/irb /Users/esanchez/.rvm/rubies/ruby-1.9.3-p374/bin/rake /Users/esanchez/.rvm/rubies/ruby-1.9.3-p374/bin/rdoc /Users/esanchez/.rvm/rubies/ruby-1.9.3-p374/bin/ri /Users/esanchez/.rvm/rubies/ruby-1.9.3-p374/bin/ruby /Users/esanchez/.rvm/rubies/ruby-1.9.3-p374/bin/testrb
ruby-1.9.3-p374 - #adjusting #shebangs for (gem irb erb ri rdoc testrb rake).
ruby-1.9.3-p374 - #importing default gemsets, this may take time ...
Executing: '/Users/esanchez/.rvm/scripts/gemsets' initial in environment ruby-1.9.3-p374
Running /Users/esanchez/.rvm/hooks/after_use_maglev
Install of ruby-1.9.3-p374 - #complete

Running /Users/esanchez/.rvm/hooks/after_use_maglev
__rvm_rm_rf already gone: /Users/esanchez/.rvm/tmp/3725*
ESanchez:~ esanchez$

Verify Ruby Installation:

And finally we verify we have ruby installed!

 ESanchez:~ esanchez$ rvm list rvm rubies =* ruby-1.9.3-p374 [ x86_64 ] # => - current
# =* - current && default
#  * - default

ESanchez:~ esanchez$ ruby -v
ruby 1.9.3p374 (2013-01-15 revision 38858) [x86_64-darwin12.2.1]
ESanchez:~ esanchez$

[Amazonproduct=0596516177]

[Amazonproduct=1449330320]

Share