Skip to content

Setting Up a Mac OS X Build Environment without MacPorts

lylejohnson edited this page Sep 13, 2010 · 16 revisions

The instructions on this page tell you what you need to do to be able to build FOX and FXRuby from source code on Mac OS X. These instructions assume that you aren’t using MacPorts, and that you’ll download the individual packages by hand and build and install them yourself.

Install Xcode Developer Tools

In order to compile anything, you’ll need to first install Apple’s Xcode Developer Tools. These are included in the operating system installation DVDs (as an extra), or you can download them for free from Apple’s Developer Center.

Install Ruby

You’re obviously going to need a Ruby installation. Since you’re not going the MacPorts route, you have a couple of choices here: either use the Ruby that comes pre-installed with Mac OS X, or download, build and install Ruby from source code. Many Ruby hackers choose the latter option so that they can run the latest release of Ruby, but the Ruby that ships with OS X is just fine for use with FXRuby. If you want to build and install Ruby from source, please see the Ruby downloads page for information on how to do that.

Install FOX Dependencies

FXRuby is based on the FOX toolkit, and so we’re going to need to build FOX. But before we can do that, we need to download, build and install some libraries that FOX depends on for image file manipulation.

Download, Build and Install LibPNG

A version of the PNG library is included with Mac OS X (in the /usr/X11/lib directory) and you can use that if you like. If you want to use a more recent version, however, you can download the latest source code tarball for libpng from the PNG home page. As of this writing, the latest version is version 1.2.40.

tar xzf libpng-1.2.40.tar.gz
cd libpng-1.2.40
./configure
make
make install

Download, Build and Install LibJPEG

You can download the latest source code tarball for libjpeg from the Independent JPEG Group. As of this writing, the latest version is version 7.

tar xzf jpegsrc.v7.tar.gz
cd jpeg-7
./configure
make
make install

Download, Build and Install LibTIFF

You can download the latest source code tarball for libtiff from the LibTIFF home page. As of this writing, the latest version is version 3.8.2.

tar xzf tiff-3.8.2.tar.gz
cd tiff-3.8.2
./configure
make
make install

Download, Build and Install FOX

You can download the latest source code tarball for FOX from the FOX home page. As of this writing, the latest stable version is version 1.6.36. Note that the latest developer version is 1.7.20 (or so), but that version is incompatible with FXRuby.

tar xzf fox-1.6.36.tar.gz
cd fox-1.6.36
env CFLAGS="-I/usr/X11/include -I/usr/X11/include/freetype2 -DHAVE_XFT_H=1" CXXFLAGS="-I/usr/X11/include -I/usr/X11/include/freetype2 -DHAVE_XFT_H=1" LDFLAGS="-L/usr/X11/lib  -lXft -lfontconfig -lfreetype" ./configure --with-x --with-opengl --enable-cups --enable-release
make
make install

Note that for some reason, I have to explicitly add /usr/X11/lib to the LDFLAGS (otherwise the build fails at link time). If you run into trouble building FOX, please consult the installation instructions at the FOX web site, and follow up on the FOX mailing list if necessary.

Install FXScintilla

This step is optional, but if you want to be able to use the FXScintilla widget in your FXRuby programs, you’ll need to get the FXScintilla library installed. The latest version of FXScintilla (as of this writing) is version 2.1.0, but I had trouble compiling it from source, so I dropped back to version 1.71. Download the source code from the FXScintilla web site and then build and install it from source.

tar xzf fxscintilla-1.71.tar.gz
cd fxscintilla-1.71
./configure
make
sudo make install

Build and Install FXRuby

At this point should be able to install FXRuby from the source gem, by typing

sudo gem install fxruby