Stickybits

Blog Categories
Twitter Updates
    follow me on Twitter
    Currently Reading
    Powered by Squarespace
    Git Projects
    « Erlang - Make, Rake and Emake | Main | Erlang Introduction (For the Ruby Guy) part 3 »
    Thursday
    Aug212008

    Setting up a Ruby 1.9 Sandbox on Leopard

    EDIT

    I have updated this and included Rails3 instructions as well in the post: Edging your way towards Ruby 1.9.1 and Rails 3.0pre.

    Please read that instead

    The next version of Ruby is right around the corner and it is propably time to start getting used to the changes and start making your code compatable to the new version. Since it's not a good idea to overwrite your existing ruby installation you should propably install a Ruby 1.9 sandbox with the following directions. Although I did this on a Mac OS X.5 machine the directions should work fine for Linux. Lets start with downloading Ruby and installing in /opt.

    cd /tmp
    curl http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.0-3.tar.gz | tar zx
    cd ruby-1.9.0-r18217
    
    autoconf
    ./configure --prefix=/opt/ruby19
    make
    sudo make install
    

    Now lets set up a command that puts you in the 1.9 sandbox when needed. Open up the file .profile in your home directory or create it if it does not exist. Add the following line

    alias ruby19="export PATH=/opt/ruby19/bin:$PATH"
    

    Close the Terminal window and open up again. Now everytime you need to put a terminal window into the Ruby 1.9 mode just type in the command ruby19. Try it out with the command ruby -v and you should see the reply:

    ruby 1.9.0 (2008-07-25 revision 18217) [i686-darwin9.4.0]
    

    Now just have fun in the sandbox. Remember that there now is a seperate gem repository so you need to get the gems you need with the gem command. For info on changes in Ruby 1.9 take a look at the Ruby 1.9: What To Expect or Migrating to Ruby 1.9 slideshows.

    Reader Comments (3)

    Thank you for posting this short howto on setting up a ruby 1.9 sandbox. This will definitely help with my plan to test my libraries and the common libraries I depend on daily with Ruby 1.9.

    Aug 22, 2008 at 23:15 | Unregistered Commenterpostmodern

    Nice and easy. And it works. :)

    Aug 27, 2008 at 15:59 | Unregistered CommenterKarmen Blake

    Thanks! It worked except for some reason, my terminal doesn't recognize my .profile, only .bash_profile

    Oct 17, 2008 at 11:35 | Unregistered CommenterKTamas

    PostPost a New Comment

    Enter your information below to add a new comment.

    My response is on my own website »
    Author Email (optional):
    Author URL (optional):
    Post:
     
    Some HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>
    Fork me on GitHub