mac os xMac OS X

These instructions use GTK+ OSX, which is a native port of GTK to macosx.
They are loosely based on tryton's build instructions.

(previous instructions used macports and py2exe but this never really worked well for packaging, it is quite useful for development and testing however)
There is also an outdated manual build version of this page, but this is now out of date.

Go to the development index page for more general information.


  • A Mac OS X system running version 10.5 or later (both x86 and PowerPC are supported)
  • gcc-4.2:
    gcc-4.2 -v
  • Developer SDK:
    ls -ld /Developer/SDKs/MacOSX10.5.sdk
  • git
Note: there are some known issues with MacPorts, you may want to follow these instructions as a separate user or at least remove the macport paths from your environment.
We are building a 32-bit binary only.


First, download the latest script and run it to setup the build environment:

curl --insecure -O

(it is unfortunate that uses a certificate that is not trusted by OSX)

As per the script's warning, you must update your PATH:
export PATH=$PATH:~/.local/bin/

The rest of the instructions will either be jhbuild commands or run from the jhbuild environment by first starting the jhbuild shell:
jhbuild shell


Modify the configuration file to use a specific (and more recent) version of Python, and some tweaks for cairo:
sed -i -e 's/^setup_sdk/#setup_sdk/g' .jhbuildrc-custom
cat << EOF >> .jhbuildrc-custom
_gtk_osx_use_jhbuild_python = True
branches["python"] = ""
module_autogenargs['cairo'] = '--enable-ft=no'
setup_sdk(target="10.5", sdk_version="10.5", architectures=["i386"])
os.environ["CC"] = "/usr/bin/gcc-4.2"
os.environ["DYLD_LIBRARY_PATH"] = ""
build_policy = "updated-deps"
modules = [ "python",
	"meta-gtk-osx-bootstrap", "meta-gtk-osx-core",
	"libcroco", "librsvg",
	"meta-gtk-osx-python", "meta-gtk-osx-themes",
	"gtk-mac-integration-python" ]
You must replace i386 with ppc if that is your build platform.
To get rid of some annoying pygobject warnings, you may want to use this patch
This will build the native version of (Py)GTK for OSX, skipping libiconv to fix library problems on Lion, this can take a while:
jhbuild bootstrap --skip=libiconv
jhbuild build
If you get an error with MakeMaker being too old:
sudo cpan -i ExtUtils::MakeMaker

gtkGStreamer 0.10 plugins

For sound support, we then build GStreamer and its modules.
If you want support for X11 and xvideo:
sed -i -e 's/--disable-x --disable-xvideo//g' ~/Source/jhbuild/modulesets/gtk-osx-gstreamer.modules
jhbuild buildone gstreamer
jhbuild buildone gst-plugins-base
jhbuild buildone gst-plugins-good

(add --enable-introspection=no if gstreamer gets stuck on GEN Gst-0.10.gir)

encodingExtra Dependencies

Next we can build the dozens of media and graphics dependencies using the xpra moduleset:
curl -O
jhbuild -m ./xpra.modules build meta-osx-xpra-deps

If you want to be able to use a recent version of subversion, just run:
jhbuild -m ./xpra.modules meta-subversion-xpra


ige-mac-bundler will be used to generate the standalone osx application bundle.
Download and install it:
curl -O
xz -d gtk-mac-bundler-0.7.3.tar.xz
tar -xf gtk-mac-bundler-0.7.3.tar
cd gtk-mac-bundler-0.7.3
make install
Then you need to apply this patch on top. (no need to run make install again - install doesn't actually install the files anywhere..)

For more information on the process of bundling, why it is necessary and how it affects the shared libraries on OSX, see Dynamic Libraries, RPATH, and Mac OS and Porting to Mac/ige-mac-bundler

pythonPython dependencies

The previous steps should have installed setuptools which can now be used to install Twisted:
easy_install -U -Z twisted==12.0

(there is a conflict between gtk on OSX and Twisted version 12.1)

desktopBuild Protocol Support

  • xpra:
    curl -O
    tar -jxf xpra-0.11.6.tar.bz2
    cd xpra-0.11.6
    python install
    cd ..
  • RDesktop:
    curl -O
    tar -zxf rdesktop-1.8.1.tar.gz
    cd rdesktop-1.8.1
    ./configure --prefix ${JHBUILD_PREFIX} --disable-credssp --disable-smartcard
    make && make install
    cd ..
  • TigerVNC:
    curl -O
    tar -zxf tigervnc-1.1.0.tar.gz
    cd tigervnc-1.1.0
    ./configure --prefix ${JHBUILD_PREFIX}
    sed -i -e 's+-lXext -lX11+-lXext -lX11 -lintl -lgettextlib -L/usr/X11/lib/+g' unix/vncviewer/Makefile
    make && make install
    cd ..
  • NX:
    curl -O
    curl -O
    curl -O
    tar -zxf nxcomp-3.5.0-2.tar.gz
    cd nxcomp
    patch -p1 < ../nxcomp.patch
    sed -i -e 's+-bundle+-dynamiclib+g' Makefile
    cp -Rp* ${JHBUILD_PREFIX}/lib/
    cd ..
    tar -zxf nxproxy-3.5.0-1.tar.gz
    cd nxproxy
    ./configure --prefix ${JHBUILD_PREFIX}
    sed -i -e 's/-lXcomp/-lXcomp -lpng -ljpeg -lz/' Makefile
    make && make install
    cd ..

setup-installerBuilding the standalone application

curl -O
tar -jxf winswitch-0.12.20.src.tar.bz2
cd winswitch-0.12.20
# Add the osx specific bits:
curl -O
tar -jxf winswitch-osx-0.12.20.src.tar.bz2
ln  -sf winswitch-osx-0.12.20 osx

./ py2app
cd osx/bundle

The resulting application bundle will be copied to the desktop.

Building a DMG disk image is currently a manual process. (see bug #76 for more details)

gdbOptional: GDB

If you ever need to debug anything on OSX with gdb, the versions shipped with xcode are well out of date. You can easily build a more recent gdb in the jhbuild shell:
curl -O
tar -jxf gdb-7.7.tar.bz2
cd gdb-7.7
./configure --prefix=${JHBUILD_PREFIX}
make && make install
#fix "Unable to find Mach task port for process-id" error:
sudo chgrp procmod ${JHBUILD_PREFIX}/bin/gdb
sudo chmod g+s ${JHBUILD_PREFIX}/bin/gdb