MacRuby soon to reach a new milestone

Laurent just posted a MacRuby status update on the mailing list and the first official beta of MacRuby 0.5 should be released pretty soon.

Let’s quickly look at Laurent’s report:

  • Early backtracing support.
  • Much better AOT compilation. Parts of the standard library are now pre-compiled for testing.
  • Migrated to LLVM top of tree.
  • Dispatcher performance is now back to normal (we lost about 30% due to gcc not inlining code).
  • Many bug fixes.

In lay terms, backtracing is what you see when your app crashes or has a problem, it’s the list of methods called before the exception was raised and the line where the error happened. Currently the backtrace is similar to what you would have with Ruby 1.9, however objective-c exceptions are not supported and there is still some work to do.

AOT compilation or Ahead Of Time compilation is the process of compiling a script into machine code. I already covered that feature earlier. Progress has been made and now some Ruby standard libraries are now pre-compiled in MacRuby. The two main advantages of doing AOT compilation are startup speed and obfuscation. Two important features for desktop applications or for when you want to license your server app.

Updating LLVM doesn’t mean much for end users. With the support of the MacRuby team, Claudio setup a nightly build bot allowing you to download nightly builds for SnowLeopard. The app is a Sinatra app that could can checkout on github: What’s interesting is that Apple is sponsoring both LLVM and MacRuby which will hopefully bring some synergy and help both projects.

Fixed dispatcher, this is a just a perf bug fix only affecting people on trunk.

I personally used MacRuby quite a lot recently. I have been writing a 2D video game for my RubyConf talk.

It’s a simple game only using Ruby and Cocoa. It’s not a fancy game and, no, it doesn’t run on the iPhone yet ;)

I never wrote a game in Cocoa and I decided not to use an existing framework like Gosu or cocos2d, instead I decided to write everything from scratch. Using CoreAnimation instead of OpenGL, the task wasn’t that hard at all. in less than 1,000 LOC (before refactoring), I have a fully working game.

I will be previewing the game at RailsSummit and will show the code and explain how to get there at RubyConf.

When I started getting involved with MacRuby, I really did not think I would write a video game in Ruby and actually enjoy it. At the end of the day, I will more than likely use MacRuby for desktop/mobile/server apps more than games, but it’s awesome to be able to use your favorite language to do other things than what you are usually paid to do.

MacRuby is coming along very nicely, and I’m really excited about the multitude of new options offered to Ruby developers on OSX and can’t wait for 0.5 final and see what people will do with it.

Similar Posts
  1. #1 by Paul Barry - October 6th, 2009 at 13:33

    Doesn’t run on the iPhone yet? Is there going to be some way to have a MacRuby app run on the iPhone?

    • #2 by Matt Aimonetti - October 6th, 2009 at 13:59

      Paul, there is indeed a plan to allow AOT compilation for the iPhone. However, there isn’t any timeline or promises, check the mailing list for the details of what still needs to be done to get the iPhone compilation working.

  2. #3 by Jonno - October 6th, 2009 at 15:55

    Will the 0.5 (with all its LLVM stuff) work on 10.5?

    • #4 by Matt Aimonetti - October 6th, 2009 at 15:58

      Hi Jonno, yes, 0.5 (trunk) works on Leopard and Snow Leopard, however the nightly build is only for SL for now. They are still some gotchas with the 32bit mode and of course you won’t be able to use the GCD API with 10.5

      I hope that helps

      • #5 by Jonno - October 6th, 2009 at 17:25

        Thanks! I am really looking forward to the 0.5 release.

  3. #6 by Jonno - October 6th, 2009 at 20:49

    Can you publish a binary of the game? I am very keen to have a play with it.

    • #7 by Matt Aimonetti - October 6th, 2009 at 20:59

      I will release it as well as the source code during RubyConf :)

      • #8 by Jonno - October 7th, 2009 at 02:07

        looking forward to it :) I wish I was going to the conf but hope to see your slides on the blog ;)

  4. #9 by roger - October 7th, 2009 at 08:34

    Linux support?

    • #10 by Matt Aimonetti - October 7th, 2009 at 08:58

      Hey Roger, technically there is nothing blocking a linux support. Apple even released a large part of GCD. However, at this time, nobody from the MacRuby is working on it. It’s worth mentioning that the project leader Laurent Sansonetti offered his assistance to anyone willing to work on Linux support.

      My guess is that the work won’t start until we have a stable and close to final version of MacRuby.

Comments are closed.