This course will become read-only in the near future. Tell us at community.p2pu.org if that is a problem.

Installing Ruby


Install ruby with package managers

Windows: Download and install Ruby using RubyInstaller

OS X: Ruby is already installed, but it might be version 1.8.7, we want the latest and greatest. ruby-lang.org has instructions in the downloads section on how to do this easliy.

Ubuntu Linux: At the command line: sudo apt-get install ruby

Extras:

For those on a *nix based system (MAC and Ubuntu) you can use Ruby Version Manager to encapsulate your ruby gems. I highly recommend this if you want to program Ruby professionally.

Task Discussion


  • __hsams__ said:

    Installed Ruby 1.9.3p362 on Fedora Linux 18.
    on Jan. 24, 2013, 1:41 p.m.
  • Jure said:

    Installed on using RubyInstaller windows 7

    on Oct. 29, 2012, 8:11 a.m.
  • Frank Murphy said:

    Installed rvm no hitches.

    But was\am aware of Fedora naming conventions.

    Just had to preinstall all deps.

    Using an F16.x86_64  40gb image, which I threw 2cpu and 4gb ram at.

    Should be sufficient.

    on April 3, 2012, 4:41 a.m.

    Andre Dublin said:

    Excellent, I don't have much experience with Fedora I'm more of an Ubuntu guy

    on April 3, 2012, 7:31 a.m. in reply to Frank Murphy
  • sedmonds said:

    Any suggestions, similar issues with git/rvm/ruby currect version upgrades or install under mac lion 10.7.3?

    I am having a time getting RVM installed and Ruby updated to the latest version. As of now, I am getting this message: 

    rvm requires autoreconf to install the selected ruby interpreter however autoreconf was not found in the PATH.

     

    My current system is:

    • Mac OS X Version 10.7.3
    • ruby 1.8.7 (2010-01-10 patchlevel 249) [universal-darwin11.0]
    • rvm 1.10.3
    • Xcode 4.3.1
    • git version 1.7.7.5 (Apple Git-26)

     

    What I've done so far:

    I downloaded the lastest version of Ruby (1.9.3), however running command 'rvm --default use 1.9.3' returns 'rvm is not a function'

    Possible problems with Zend installation: I uninstalled Zend Server CE as running the command 'which git' was pointing to a zend framework directory. Wonky. So I uninstalled the zend framework and reinstalled git under my /home directory

     

    Last:

    I am not sure if this is a permission or file/folder location issue. 

    This issue arose when I first connected to github and failed to save homework files to the /coursework directory for commit.  My work-around was to download the GitHub app for handling repositories. Though, I wonder if I've confused this installation situation more? 

     

    on March 18, 2012, 7:38 p.m.

    sedmonds said:

    bash-3.2$ rvm requirements
    
    
     Notes for Mac OS X 10.7.3, No Xcode.  # Xcode 4.3.1 is installed
    
    
    For JRuby:  Install the JDK. See http://developer.apple.com/java/download/  # Current Java version "1.6.0_26"
    
    For IronRuby: Install Mono >= 2.6
    
    For Ruby 1.9.3: Install libksba # If using Homebrew, 'brew install libksba'
    
    
    You can use & download osx-gcc-installer: https://github.com/kennethreitz/osx-gcc-installer
    
    ** NOTE: Currently, Node.js is having issues building with osx-gcc-installer. The only fix is to install Xcode over osx-gcc-installer.
    
    
    We had reports of http://hpc.sourceforge.net/ making things work, but it looks like not easiest/safest to setup.
    
    
    To use an RVM installed Ruby as default, instead of the system ruby:
    
    
        rvm install 1.8.7 # installs patch 357: closest supported version
    
        rvm system ; rvm gemset export system.gems ; rvm 1.8.7 ; rvm gemset import system.gems # migrate your gems
    
        rvm alias create default 1.8.7
    
    
    And reopen your terminal windows.
    
    
    Xcode 4.2:
    
     * is only supported by ruby 1.9.3+ using command line flag: --with-gcc=clang
    
     * it breaks gems with native extensions, especially DB drivers.

    on March 18, 2012, 8:04 p.m. in reply to sedmonds

    Andre Dublin said:

     

    It looks like your missing some necessary binarys, what does your echo $PATH output? Also here is are some links on the autoconf problem.

    http://stackoverflow.com/questions/9575989/install-autoreconf-on-osx-lion

    http://ithaca.arpinum.org/2012/02/20/fun-with-osx.html

    on March 18, 2012, 8:41 p.m. in reply to sedmonds

    Andre Dublin said:

    I've used the Github app before, it creates it's own separate folders for repos you wish to clone.  This won't cause any conflicts in the system.

     

    this should be your git workflow

    $ git add filename or $ git add .
    
    " . " means all files
    $ git commit -m "this is your message"
    
    $ git push origin master
    on March 18, 2012, 8:50 p.m. in reply to sedmonds

    Andre Dublin said:

    Heres a great explanation of the autoconf problem.

    http://brianpeddle.com/tag/autoreconf/

    on March 18, 2012, 8:53 p.m. in reply to sedmonds

    sedmonds said:

    Thanks, Andre.

    For those that are interested, I am reading the Ruby on Rails Tutorial by Michael Hartl.

     

    A quote from Chapter 1.2 called Up and Running, he quotes:

    I think of Chapter 1 as the “weeding out phase” in law school—if you can get your dev environment set up, the rest is easy to get through. 
    —Bob Cavezza

    Also:

    During a failed installation of Ruby 1.9.3, I received an error (runtime?) that xcode-debugopt-fix-r34840.diff could not be run.

    Looking at the error log:

     

    patching file configure.in

    Hunk #1 FAILED at 289.

    Hunk #2 succeeded at 488 with fuzz 3.

    Hunk #3 succeeded at 504 with fuzz 2 (offset -10 lines).

    1 out of 3 hunks FAILED -- saving rejects to file configure.in.rej

     

    After looking at the error log, I found in the Ruby Tutorial on some older OS X systems,
    you might have to include the path to the readline library:

    		$ rvm install 1.9.3 --with-readline-dir=/opt/local 
    on March 19, 2012, 8:42 p.m. in reply to Andre Dublin

    Rhodee said:

    Hi,

     

    I am not a Mac user (Linux) but I came across some tools that might make this part of the development process less like death.

     

    First there is a company called thoughtbot that provides a script called laptop (Mac OSX 10.6 or greater): https://github.com/thoughtbot/laptop

    Immediate benefit: you don't have to download Xcode. Which seems to give everyone in the environment fits @ some point or another. Instead it installs GCC which is a bit less dense than Xcode, a robust software (IDE, etc.).

    You will need to download GCC first and then run the laptop script. You get quite a bit for not a lot of work. I just went through this install with a designer colleague. It went on with very few hitches.

    on March 20, 2012, 6:41 p.m. in reply to sedmonds
  • Frank Murphy said:

    Willl be running late.

    Dogs dinner of a week.

    Waiting on ram, hd, to rebuild kvm host, and redeploy guests.

    on March 9, 2012, 4:50 a.m.
  • F0ry said:

    Had some issues installing RVM on Mac os x 10.6.8 but I checked the installation logs and saw I don't have Xcode. I thought I did when I ran rvm requirements. Oh well, there's a couple more days before this starts, so I guess I have enough time to get xcode 3.2.6 and install RVM. Thanks for the information

    on March 8, 2012, 7:34 p.m.

    Andre Dublin said:

    Sorry about that, forgot about rvm's dependency on Xcode

    on March 9, 2012, 7:28 a.m. in reply to F0ry
  • Andre Dublin said:

    I can't stress enough the awesomeness of Ruby Version Manager.  I recommend that you use that if you are on a *nix system.

     

    Also I found a windows only installer of Ruby on Rails here http://railsinstaller.org/ I believe this would be a better choice than Ruby Installer, unless you want to build your own.

    on March 7, 2012, 11:05 p.m.

    Mark Finlay said:

    I agree. RVM is excellent. Have you tried rbenv? What's the major diferences between RVM and rbenv?

    on March 9, 2012, 7:11 p.m. in reply to Andre Dublin

    Andre Dublin said:

    I've played with it a bit, but enjoy the cmd line that rvm provides over rbenv.

    on March 9, 2012, 10:16 p.m. in reply to Mark Finlay

    Andre Dublin said:

    The established leader in the Ruby version management scene isRVM but rbenv is an interesting alternative if you want or need something significantly lighter with fewer features. Think of it as a bit like Sinatra and Rails.

     

    Did some interweb searching and came across this about rbenv compared to rvm

     

    http://www.rubyinside.com/rbenv-a-simple-new-ruby-version-management-tool-5302.html

    on March 9, 2012, 10:28 p.m. in reply to Mark Finlay