Ruby Weekly is a weekly newsletter covering the latest Ruby and Rails news.

How To Start Playing With Ruby 1.9 Right Now!

By Peter Cooper / November 27, 2007

Ruby 1.9 is almost upon us! With an expected release date around this Christmas, it won't be long until you can start to play with Ruby 1.9 and enjoy some of the much-hailed performance increases (not to mention features).

"But I want it now!" you say. Well, as an open source project with an active ruby-core community working on a public code repository, it's totally possible to get yourself a copy of Ruby 1.9 and begin playing with it today. You can't expect to run production code on it and you shouldn't expect any code to be rock solid, but with the release date such a short time away, you might find it feels "close enough" now for you to really get knee-deep in the new features, and you know how great it'll be to pull out some great new techniques later on when the rest of your co-workers are still upgrading..

I've just exported the latest version of Ruby 1.9 from the ruby-core trunk. If you have SVN and you're happy to do this too, follow the instructions given here, otherwise follow the instructions below to use my "no SVN required" technique:

Fire up your shell or terminal app.

Download and un-tar:

On some operating systems this is as simple as:

tar xzvf

Then get installing..

cd ruby1.9-trunk
./configure --prefix=/usr/local/ruby1.9
sudo make install

By now you should have Ruby 1.9 installed in its own directory (so it won't mess up your existing Ruby 1.8 install). Don't worry if an error crops up during documentation generation (I get a "Bus Error") as the key items are already installed and ready to use like so:

/usr/local/ruby1.9/ruby -v


Double check that you're running the right version when you're in IRB and try out a new feature:

iMac2007:ruby19 peter$ /usr/local/ruby1.9/bin/irb
=> "2007-11-27 20:15:44 +0000"
=> true

Enjoy! Give some of your usual Ruby apps a try if you like, run some performance tests, or check out this insanely detailed list of changes and new features in Ruby 1.9. Have a play, and if you find anything other readers might find interesting, leave a comment here at Ruby Inside!


  1. Michiel de Mare says:

    I get this error: parse.y:580: unrecognized: %parse_param

    I guess I'll have to wait till Christmas...

  2. Peter Cooper says:

    Which architecture and operating system? If there's a pattern, then people will probably want to know :)

    FWIW, my instructions above are fine on OS X Leopard on x86. Haven't tried on Linux yet.

  3. Peter Cooper says:

    For what it's worth, I ran a basic test using the same code to do a fib(30) in both Ruby 1.8.6 and Ruby 1.9, and it takes 5.5 seconds to calculate in 1.8.6 and 0.4 seconds in 1.9. It's not really a particularly wide ranging test, but that result says a lot about method invocation speed in 1.9.

  4. James Healy says:

    Debian and Ubuntu already have a ruby1.9 package if people want to try it, although the same packaging packaging style is used as that for 1.8, so it's a little kooky....

  5. Brian Broom says:

    Mine blows up here (OS X 10.4.10)

    bison -o parse.y
    parse.y:580: unrecognized: %parse_param
    parse.y:580: Skipping to next %
    make: *** [parse.c] Error 1

  6. Michiel de Mare says:

    OSX Tiger on PPC. Did some research and found this thread:'s-parse.c-fails-to-compile-t4798113.html

    Apparently a newer version of Bison is required, so Ruby 1.9 won't compile out of the box on Tiger at all.

  7. Chu Yeow says:

    I ran into the same problem Michiel. Googling led me to and installing the latest bison (I read you need 2.2+) worked.

  8. Chu Yeow says:

    Ah it appears I was on an older version of this page for too long. Glad you found the solution already Michiel :)

    Brian: you need to install Bison version 2.2+ (I just used the MacPorts one, sudo port install bison).

  9. Chris says:

    So can you run Rails on 1.9 yet?

  10. Anko says:

    Umm.. Those performance increases seem to be from April. Anyone got any newer figures?

  11. Peter Cooper says:

    I've yielded a 13x speedup on a fib(30) from 1.8.6 to 1.9. If you get it installed then it's worth running some tests on your own code or algorithms, or just copy the code from someplace else (such as these). I'm sure people will start to post more figures as the releases seep out.

  12. Brian Broom says:

    Thanks for the Bison tip. Works fine now.

    I just ran a simple floating point calculation (ran for about a minute) with a 1.7x speedup (100 sec vs. 60 sec). From all of the tests I've run, converting floating point ruby code to C gives about a 10-15x speedup, so to get 2x for nothing is very nice.

    I've posted the code I ran at if any of you are interested. Feel free to poke holes in my code...

  13. Sean O'Neil says:

    If anyone is interested in Ruby for Windows, I've tried 1.9 on Windows. It is faster than 1.8 in Windows, but it still runs a lot slower in Windows than in other OS's. I'm not sure, but I suspect it has something to do with the stack checks that were added to stop Windows developers from calling it from multiple threads (which really sucks because synchronization is not that hard).

    Also, if you try to embed it into C or C++, it crashes. I posted it as a bug, and it's been assigned to Matz, so hopefully it won't be a bug for much longer.

  14. Tom says:

    Ugh, seeing that new Ruby logo again is so depressing. :(

  15. John Pywtorak says:

    Watch out for this error if your have a GEM_HOME defined in your environment.
    gem_prelude.rb:134:in `block (2 levels) in push_all_highest_version_gems_on_load_path': bad value for range (ArgumentError)
    from gem_prelude.rb:131:in `each'
    from gem_prelude.rb:131:in `block in push_all_highest_version_gems_on_load_path'
    from gem_prelude.rb:128:in `each'
    from gem_prelude.rb:128:in `push_all_highest_version_gems_on_load_path'
    from gem_prelude.rb:178:in `'

    Fix is to clear it, export GEM_HOME=, or unset GEM_HOME, etc. re-run make install, irb, etc.

  16. John Joyce says:

    13x on a fib(30) is pretty decent.
    I can't wait to try it, I'm just a hair concerned about the pitfalls of 1.9 changes.
    I wonder if I'm going to feel all green again...?
    Any word yet on Ruby 1.9 Vs. Rails 2.0?

  17. Ob says:

    The logo is sooo wrong.

  18. Eric O'Connell says:

    Just as a note, I got the same bus error you did (on 10.5 / Core 2 Duo MacBook Pro). Then I realized that I built ruby without readline support.. Adding that in fixed the bus error on doc generation. And boy, does rdoc generate faster than it used to!

Other Posts to Enjoy

Twitter Mentions