'Installing Ruby 1.9.3 on Mac

I have ruby 1.9.2p320 installed on my Mac and I tried to update it but don't know how so I used rvm to install ruby 1.9.3 and once that had finished installing, after typing ruby -v I still get ruby 1.9.2p320.

Update

I now have ruby 1.9.3 installed thanks to Simone Carletti!



Solution 1:[1]

You can also install use rbenv to install and manage different versions of Ruby.

Note: I don't have anything against rvm. I simply noticed that installing various Rubies is a constant source of questions, both in Stack Overflow and also at work!

Requirements

  • Here I'm assuming that you have Homebrew. (If you haven't installed that yet, make sure your permissions are correct on /usr/local/ after installation is complete, or you can run into mysterious-looking errors that should not be preventing you from installing Ruby.)
  • Run rvm implode before installing rbenv. This will destroy rvm.

To install rbenv using Homebrew

  1. Update Homebrew.

     $ brew update
    
  2. Install rbenv.

     $ brew install rbenv
    
  3. Install ruby-build.

     $ brew install ruby-build
    
  4. Follow the instructions listed after installing these formulae in order to make it available correctly in your shell.

To install Ruby 1.9.3

  1. See what versions of Ruby you can install.

     $ rbenv install
    
  2. Install one. The lastest as of this post is 1.9.3-p194.

     $ rbenv install 1.9.3-p194
    

To use Ruby 1.9.3

$ rbenv global 1.9.3-p194 

To rehash rbenv

Sometimes you need to run rbenv rehash, like when you install a gem that has native extensions for your operating system.

$ rbenv rehash

There are lots of other things you can do with rbenv, like use a particular Ruby in a particular directory, or a particular ruby in the shell. See the appropriate docs for more info!

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Glorfindel