Ruby 1.9 on Mac OS X

UPDATE: use this instead Ruby Version Manager

Quick steps for installing Ruby 1.9.1 while preserving the existing ruby installation.

Things to know before following these directions:

  • I don’t use MacPorts or Fink. There is nothing wrong with using either of them, I just prefer not to.
  • I’m doing this on an Intel Mac running Mac OS X 10.5.7, no guarantees for any other
  • architecture or OS X version
  • i use ~/source for most of my development work.
  • I wrote this for some of my less system minded co-workers
Open a terminal window and type the following commands

Install GNU Readline. Skip this step if you already have readline installed. You may also use Fink or MacPorts to install.

  • tar xvzf readline-6.0.tar.gz
  • cd readline-6.0
  • ./configure
  • make
  • sudo make install
  • Install Ruby 1.9.1:
Create an alias for using the new ruby:
  • cd ~
  • vim .bash_profile
  • add this line: alias ruby-19=’export PATH=/opt/ruby/bin:$PATH’
  • save the file and exit vim
You can either exit the terminal and restart it or type source ~/.bash_profile to enable the new alias.To start using the new ruby, just type ruby-19

Install notes for some common gems:

  • enter ruby -v to make sure you’re using the correct version of ruby. It should report version
  • 1.9.1p203, if not, enter the ruby-19 command created above.
  • MySQL - install hectoregm-mysql-ruby. The mysql gem doesn’t work on Ruby 1.9
  • rspec and rspec-rails. You need to also install test-unit v1.2.3 for rspec-rails to work properly.
  • Make sure that v1.2.3 is the only one installed. If you also have a newer version installed, things 
won’t work.
  • mongrel - needs to be patched using these directions http://isitruby19.com/mongrel . If you 
followed my directions, change the path in step 1 to /opt/ruby19/lib/ruby/gems/1.9.1/gems/mongrel-1.1.5/ext/http11
  • mongrel_cluster
  • check http://isitruby19.com for other gems

Posted by tommy Fri, 26 Jun 2009 07:32:00 GMT