Installing FXRuby on OS X

Thought I’d do some hacking on FXRuby today. I ran into trouble during the installation so I’m posting the solutions here in case anyone else experiences the same issues.

I attempted installing the fxruby gem first, but didn’t get very far. I ended up having success with the rb-fxruby package for MacPorts so I highly recommend going that route.

Make sure you uninstall and clean the gem if it’s already installed:

gem uninstall fxruby
gem clean fxruby

Now install the MacPorts package:

port install rb-fxruby

This might take a while. You may have to run the command twice if you get a failure the first time through. Now copy and paste this script into a .rb file and try running it:

require 'rubygems'
require 'fox16'

include Fox

app =
win =, 'Hello World')


You should see an error message that looks something like this:

FXRbApp::openDisplay: unable to open display :0.0

It means your X11 terminal isn’t running. You can find it in /Applications/Utilities. Double click to launch. If you roll with Quicksilver, you should be able to type in X11 and launch it that way. Once launched, run the Ruby script again and you should see a tiny window with the title “Hello World.”