in Libraries

OSX Lion Rubygame Install

I tried setting up Rubygame on Snow Leopard this time last year. I had many difficulties setting up SDL. I had some time to kill so I tried to set it up again, this time on my new MacBook Air running Lion.

This old blog post from 2005 helped me this time around: // to nail down the requirements. Instead of following the installation instructions here, I used Homebrew to set things up.

One of the key requirements is rubysdl, ruby bindings for the SDL multimedia library, and the rsdl gem. The following Gist is a rubysdl Homebrew formula that will help install the required packages: The SGE formula is not part of the included formulas. I forked the following Gist to provide SGE:

<h1>install the sge graphics lib</h1>

brew install sge

<h1>install rubysdl ruby sdl bindings</h1>

brew install rubysdl

<h1>install the required gem</h1>

gem install rsdl
gem install rubygame

Afterwards, most of the rubygame samples ran fine, but the ones requiring opengl had issues. I installed ruby 1.9.2 using rbenv, compiled a new dynamic library libruby.dylib, based on the 1.9.2 source. Then, I cloned this repo providing an upgraded ruby-opengl gem:

<h1>clone the repo</h1>

git clone
cd ruby-opengl

<h1>make sure that the libruby.1.9.1.dylib compiled from the</h1>

<h1>ruby 1.9.2 source is present in the gcc class path. For</h1>

<h1>me, it was ~/.rbenv/versions/1.9.2-p290/lib/libruby.dylib</h1>

<h1>use build option --enable-shared</h1>


<h1>build the gem</h1>

rake gem

<h1>install the gem</h1>

gem install pkg/ruby-opengl-0.60.1.gem

Afterwards, the rubygame opengl samples compiled fine.