New Project Home
GTK+OSX is now consolidated at http://gtk-osx.sourceforge.net/, where you'll find up-to-date information about building, bundling, and integrating GTK+ applications on Mac OSX. There is a forum, a mailing list, and a tracker there. The following is deprecated! The current information is at http://sourceforge.net/apps/trac/gtk-osx/wiki/Build
Using the framework
The prebuilt GTK+ framework found at http://www.gtk-osx.org/ can be used in three different ways: with Xcode, with a simple makefile, or with Pkgconfig.
Xcode
Xcode is the standard IDE for development on the Mac. You can download it from the Apple Developer Connection (free registration required). If you decide to use Xcode, the easiest way to get started is to create a new project using the GTK+ application template that is shipped with the framework.
Xcode 2.5 on Mac OS X 10.4
On Mac OS X 10.4.x, you cannot use Xcode 3.x, so you'll have to stick with 2.5. The framework doesn't provide a template for Xcode 2.4, so please install 2.5.
Simple makefile
INCLUDES = \
-I/Library/Frameworks/Gtk.framework/Headers \
-I/Library/Frameworks/GLib.framework/Headers \
-I/Library/Frameworks/Cairo.framework/Headers
all: hello
hello: hello.c
gcc -framework Gtk $(INCLUDES) -o $@ hello.cThe reason the include paths have to be specified is that the header files of GLib, GTK+ etc do not follow the standard layout for frameworks, and changing this would break GTK+ application code that works on other platforms.
Pkgconfig
The recommended way is to use jhbuild, which is a build script that is used to build GTK+, GNOME and many other projects. Use the script provided at http://downloads.sourceforge.net/sourceforge/gtk-osx/gtk-osx-build-setup.sh and run it to check out jhbuild and the necessary configuration files to go with it:
sh gtk-osx-build-setup.sh
The run the initial setup that installs the necessary tools:
JHB=fw-10.4 jhbuild bootstrap
The last step is to start a jhbuild shell, which will give you an environment where the frameworks are accessible through pkg-config:
JHB=fw-10.4 jhbuild shell
Now you can build your regular autotools based projects, or simple makefiles with pkg-config.
If you want to build other modules through jhbuild, against the framework, you can do:
JHB=fw-10.4 jhbuild buildone module-name-here