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

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

OR the next (taken from the rvm homepage)

bash

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

The result for the command is

bash

  1. Downloading RVM from wayneeseguin branch master
  2.   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
  3.                                  Dload  Upload   Total   Spent    Left  Speed
  4. 100   131  100   131    0     0    106      0  0:00:01  0:00:01 --:--:--   168
  5. 100 1490k  100 1490k    0     0   179k      0  0:00:08  0:00:08 --:--:--  151k
  6.  
  7. Installing RVM to /Users/esanchez/.rvm/
  8.     Adding rvm PATH line to /Users/esanchez/.bashrc /Users/esanchez/.zshrc.
  9.     Adding rvm loading line to /Users/esanchez/.bash_profile /Users/esanchez/.zprofile.
  10.  
  11. # RVM:  Shell scripts enabling management of multiple ruby environments.
  12. # RTFM: https://rvm.io/
  13. # HELP: http://webchat.freenode.net/?channels=rvm (#rvm on irc.freenode.net)
  14. # Cheatsheet: http://cheat.errtheblog.com/s/rvm/
  15. # Screencast: http://screencasts.org/episodes/how-to-use-rvm
  16.  
  17. # In case of any issues read output of 'rvm requirements' and/or 'rvm notes'
  18.  
  19. Installation of RVM in /Users/esanchez/.rvm/ is almost complete:
  20.  
  21.   * To start using RVM you need to run `source /Users/esanchez/.rvm/scripts/rvm`
  22.     in all your open shell windows, in rare cases you need to reopen all shell windows.
  23.  
  24. # esanchez,
  25. #
  26. #   Thank you for using RVM!
  27. #   I sincerely hope that RVM helps to make your life easier and
  28. #   more enjoyable!!!
  29. #
  30. # ~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:

bash

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

bash

  1. 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!

bash

  1. ESanchez:~ esanchez$ rvm install 1.9.3 --reconfigure --debug -C --enable-pthread --with-gcc=clang
  2. 1.9.3 - install
  3. found compiler: clang
  4. Fetching yaml-0.1.4.tar.gz to /Users/esanchez/.rvm/archives
  5. Fetching: https://rvm.io/src/yaml-0.1.4.tar.gz
  6. Fetch command: curl  -f -L --create-dirs -C - -o yaml-0.1.4.tar.gz
  7. Archive checksum matched, not downloading
  8. Downloaded archive checksum matched.
  9. Extracting yaml to /Users/esanchez/.rvm/src/yaml-0.1.4
  10. [2013-01-31 16:22:45] __rvm_package_extract
  11. __rvm_package_extract ()
  12. {
  13.     rvm_debug __rvm_package_extract:$#: "$@";
  14.     [[ -d "$2" ]] || mkdir -p "$2";
  15.     case "$1" in
  16.         *.zip)
  17.             unzip -q -o "$1" -d "$2"
  18.         ;;
  19.         *.tar.bz2)
  20.             ${rvm_tar_command:-tar} xjf "$1" -C "$2" ${rvm_tar_options:-}
  21.         ;;
  22.         *.tar.gz | *.tgz)
  23.             ${rvm_tar_command:-tar} xzf "$1" -C "$2" ${rvm_tar_options:-}
  24.         ;;
  25.         *)
  26.             return 199
  27.         ;;
  28.     esac
  29. }
  30. current path: /Users/esanchez/.rvm/src
  31. command(3): __rvm_package_extract /Users/esanchez/.rvm/archives/yaml-0.1.4.tar.gz /Users/esanchez/.rvm/src
  32. Configuring yaml in /Users/esanchez/.rvm/src/yaml-0.1.4.
  33. [2013-01-31 16:22:45] ./configure
  34. current path: /Users/esanchez/.rvm/src/yaml-0.1.4
  35. command(5): ./configure --prefix=/Users/esanchez/.rvm/usr --enable-pthread --with-gcc=clang --disable-shared
  36. Compiling yaml in /Users/esanchez/.rvm/src/yaml-0.1.4.
  37. [2013-01-31 16:22:50] make
  38. current path: /Users/esanchez/.rvm/src/yaml-0.1.4
  39. command(1): make
  40. Installing yaml to /Users/esanchez/.rvm/usr
  41. [2013-01-31 16:22:55] make
  42. current path: /Users/esanchez/.rvm/src/yaml-0.1.4
  43. command(2): make install
  44. rvm_configure_flags+=( --with-opt-dir=/Users/esanchez/.rvm/usr )
  45. found compiler: clang
  46. Installing Ruby from source to: /Users/esanchez/.rvm/rubies/ruby-1.9.3-p374, this may take a while depending on your cpu(s)...
  47. ruby-1.9.3-p374 - #downloading ruby-1.9.3-p374, this may take a while depending on your connection...
  48. Fetching: http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p374.tar.bz2
  49. Fetch command: curl  -f -L --create-dirs -C - -o ruby-1.9.3-p374.tar.bz2
  50. No archive, downloading
  51.   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
  52.                                  Dload  Upload   Total   Spent    Left  Speed
  53. 100 9782k  100 9782k    0     0   322k      0  0:00:30  0:00:30 --:--:--  371k
  54. Downloaded archive checksum matched.
  55. ruby-1.9.3-p374 - #extracting ruby-1.9.3-p374 to /Users/esanchez/.rvm/src/ruby-1.9.3-p374
  56. [2013-01-31 16:23:26] __rvm_package_extract
  57. __rvm_package_extract ()
  58. {
  59.     rvm_debug __rvm_package_extract:$#: "$@";
  60.     [[ -d "$2" ]] || mkdir -p "$2";
  61.     case "$1" in
  62.         *.zip)
  63.             unzip -q -o "$1" -d "$2"
  64.         ;;
  65.         *.tar.bz2)
  66.             ${rvm_tar_command:-tar} xjf "$1" -C "$2" ${rvm_tar_options:-}
  67.         ;;
  68.         *.tar.gz | *.tgz)
  69.             ${rvm_tar_command:-tar} xzf "$1" -C "$2" ${rvm_tar_options:-}
  70.         ;;
  71.         *)
  72.             return 199
  73.         ;;
  74.     esac
  75. }
  76. current path: /Users/esanchez/.rvm/src
  77. command(3): __rvm_package_extract /Users/esanchez/.rvm/archives/ruby-1.9.3-p374.tar.bz2 /Users/esanchez/.rvm/tmp/rvm_src_3725
  78. __rvm_rm_rf already gone: /Users/esanchez/.rvm/src/ruby-1.9.3-p374
  79. ruby-1.9.3-p374 - #extracted to /Users/esanchez/.rvm/src/ruby-1.9.3-p374
  80. Trying patch 'default'.
  81. Patch name 'default'.
  82. All found patches(0): .
  83. ruby-1.9.3-p374 - #configuring
  84. [2013-01-31 16:23:29] ./configure
  85. current path: /Users/esanchez/.rvm/src/ruby-1.9.3-p374
  86. 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
  87. ruby-1.9.3-p374 - #compiling
  88. [2013-01-31 16:23:54] make
  89. current path: /Users/esanchez/.rvm/src/ruby-1.9.3-p374
  90. command(1): make
  91. __rvm_rm_rf already gone: /Users/esanchez/.rvm/src/ruby-1.9.3-p374/.ext/rdoc
  92. ruby-1.9.3-p374 - #installing
  93. [2013-01-31 16:25:40] make
  94. current path: /Users/esanchez/.rvm/src/ruby-1.9.3-p374
  95. command(2): make install
  96. Running /Users/esanchez/.rvm/hooks/after_use_maglev
  97. Running /Users/esanchez/.rvm/hooks/after_use_maglev
  98. __rvm_rm_rf already gone: /Users/esanchez/.rvm/src/rubygems-1.8.25
  99. Retrieving rubygems-1.8.25
  100. Fetching: http://production.cf.rubygems.org/rubygems/rubygems-1.8.25.tgz
  101. Fetch command: curl  -f -L --create-dirs -C - -o rubygems-1.8.25.tgz
  102. No archive, downloading
  103.   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
  104.                                  Dload  Upload   Total   Spent    Left  Speed
  105. 100  371k  100  371k    0     0   399k      0 --:--:-- --:--:-- --:--:--  698k
  106. Downloaded archive checksum matched.
  107. Extracting rubygems-1.8.25 ...
  108. [2013-01-31 16:25:45] __rvm_package_extract
  109. __rvm_package_extract ()
  110. {
  111.     rvm_debug __rvm_package_extract:$#: "$@";
  112.     [[ -d "$2" ]] || mkdir -p "$2";
  113.     case "$1" in
  114.         *.zip)
  115.             unzip -q -o "$1" -d "$2"
  116.         ;;
  117.         *.tar.bz2)
  118.             ${rvm_tar_command:-tar} xjf "$1" -C "$2" ${rvm_tar_options:-}
  119.         ;;
  120.         *.tar.gz | *.tgz)
  121.             ${rvm_tar_command:-tar} xzf "$1" -C "$2" ${rvm_tar_options:-}
  122.         ;;
  123.         *)
  124.             return 199
  125.         ;;
  126.     esac
  127. }
  128. current path: /Users/esanchez/.rvm/src/ruby-1.9.3-p374
  129. command(3): __rvm_package_extract /Users/esanchez/.rvm/archives/rubygems-1.8.25.tgz /Users/esanchez/.rvm/src
  130. Removing old Rubygems files...
  131. __rvm_rm_rf already gone: /ubygems.rb
  132. __rvm_rm_rf already gone: /gauntlet_rubygems.rb
  133. __rvm_rm_rf already gone: /rbconfig/
  134. __rvm_rm_rf already gone: /rubygems*
  135. Installing rubygems-1.8.25 for ruby-1.9.3-p374 ...
  136. [2013-01-31 16:25:45] /Users/esanchez/.rvm/rubies/ruby-1.9.3-p374/bin/ruby
  137. current path: /Users/esanchez/.rvm/src/rubygems-1.8.25
  138. 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
  139. Installation of rubygems completed successfully.
  140. Running /Users/esanchez/.rvm/hooks/after_use_maglev
  141. Saving wrappers to '/Users/esanchez/.rvm/bin'.
  142. [2013-01-31 16:25:45] chmod
  143. current path: /Users/esanchez/.rvm/src/ruby-1.9.3-p374
  144. 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
  145. ruby-1.9.3-p374 - #adjusting #shebangs for (gem irb erb ri rdoc testrb rake).
  146. ruby-1.9.3-p374 - #importing default gemsets, this may take time ...
  147. Executing: '/Users/esanchez/.rvm/scripts/gemsets' initial in environment ruby-1.9.3-p374
  148. Running /Users/esanchez/.rvm/hooks/after_use_maglev
  149. Install of ruby-1.9.3-p374 - #complete
  150.  
  151. Running /Users/esanchez/.rvm/hooks/after_use_maglev
  152. __rvm_rm_rf already gone: /Users/esanchez/.rvm/tmp/3725*
  153. ESanchez:~ esanchez$

Verify Ruby Installation:

And finally we verify we have ruby installed!

bash

  1. ESanchez:~ esanchez$ rvm list rvm rubies =* ruby-1.9.3-p374 [ x86_64 ] # => - current
  2. # =* - current && default
  3. #  * - default
  4.  
  5. ESanchez:~ esanchez$ ruby -v
  6. ruby 1.9.3p374 (2013-01-15 revision 38858) [x86_64-darwin12.2.1]
  7. ESanchez:~ esanchez$

[Amazonproduct=0596516177]

[Amazonproduct=1449330320]

Share