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: //inquirylabs.com/blog2005/?p=21 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: https://gist.github.com/1394440. The SGE formula is not part of the included formulas. I forked the following Gist to provide SGE: https://gist.github.com/1394414/.


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

wget https://gist.github.com/raw/1394414/4a6bfa4a8bab179ebe263b1d044a4322c7628f60/sge.rb
brew install sge

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

wget https://raw.github.com/gist/1394440/8a71160306ad277f08fbad3eaf028b2e8700f2f1/rubysdl.rb
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: https://github.com/theymaybecoders/ruby-opengl.


<h1>clone the repo</h1>

git clone https://github.com/theymaybecoders/ruby-opengl
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>

rake

<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.