user1505209
user1505209

Reputation: 291

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!

Upvotes: 1

Views: 452

Answers (2)

fdsaas
fdsaas

Reputation: 714

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!

Upvotes: 1

Simone Carletti
Simone Carletti

Reputation: 176402

To install a Ruby version with RVM

$ rvm install 1.9.3

then to switch to it

$ rvm use 1.9.3

The latter command is probably the one you forgot to execute.

You might want to configure an .rvmrc file for your project in order to remember the settings.

About the other issue, you should open a separate question.

Upvotes: 2

Related Questions