Version 28 (modified by jeremyhu@…, 5 years ago) (diff)


Developer Info


Starting with Leopard (Mac OS-X 10.5), the version of X11 shipped with Apple's OS has been based on X11 as distributed from The shipping version of X11 with Leopard was based on's modular X11R7.2 release. In fact, most components of X11 can be easily built directly from's distributed tarballs.

Helping Out

If you'd like to help out with development, please join the xquartz-dev mailing list. Patches are greatly appreciated. Please send them in a format that can be easily applied with patch. You can do this with 'diff -Naurp <original source tree> <new source tree>' or by using git diff.

You should setup an account at, so you can submit and comment in bugs. Click on the link in the upper right corner of this page.

If you are planning on doing substantial work for Xquartz, you should get git commit access. You will need a account to do that.

Package Installation

Building and Installing

For simple, verified, step-by-step instructions for building and installing XQuartz, see the Build Instructions page. They can be a good starting place for setting up your development environment.


The latest releases of xserver require updates to other X11 packages to compile. Running ./configure should cause an error if you are missing any of these dependencies. These requirements are included in the latest binary package from our releases page. It is recommended that you install the latest binary package before rebuilding any of its components.


In addition to X11 dependencies, you will need to install pkg-config.

curl -LO
tar -xzf pkg-config-0.23.tar.gz
cd pkg-config-0.23
./configure && make && sudo make install

MacPorts, Fink, Gentoo Conflicts

You may encounter some problems if you have Fink, MacPorts, Gentoo, NetBSD Pkgsrc, or another package system in your environment. Before compilation, try sourcing a script like this:

export PKG_CONFIG="/usr/local/bin/pkg-config"

strip_finkmp() {
        local OIFS=$IFS
        local d
        for d in ${@} ; do
                if [[ "${d}" == "${d#/opt/local}" && "${d}" == "${d#/sw}" && "${d}" == "${d#/opt/gentoo}" ]] ; then
                        echo -n "${d}:"

export PATH="/usr/X11/bin:$(strip_finkmp ${PATH})"
export CPLUS_INCLUDE_PATH="/usr/X11/include:$(strip_finkmp ${CPLUS_INCLUDE_PATH})"
export C_INCLUDE_PATH="/usr/X11/include:$(strip_finkmp ${C_INCLUDE_PATH})"
export OBJC_INCLUDE_PATH="/usr/X11/include:$(strip_finkmp ${OBJC_INCLUDE_PATH})"
export PKG_CONFIG_PATH="/usr/X11/share/pkgconfig:/usr/X11/lib/pkgconfig:/usr/share/pkgconfig:/usr/lib/pkgconfig:$(strip_finkmp ${PKG_CONFIG_PATH})"

export ACLOCAL="aclocal -I /usr/X11/share/aclocal"


Before attempting to compile the server, you should first install the latest Xquartz release to ensure you have the latest headers and libraries.

To recompile xserver (which provides Xquartz,, Xephyr, Xfake, Xnest, and Xvfb), you will need to download Mesa3D (1.4 branch only -- version 7.0.4) as well as the xserver tarball from our releases page. Then you can compile them as follows:

tar jxvf MesaLib-7.0.4.tar.bz2 # only if using the 1.4 branch
tar jxvf xserver-<version>.tar.bz2
cd xorg-server-<version>

export ACLOCAL="aclocal -I /usr/X11/share/aclocal"
export PKG_CONFIG_PATH=/usr/X11/lib/pkgconfig

export CFLAGS="-Wall -O2 -arch i386 -arch ppc -pipe"
export LDFLAGS="-Wall -O2 -arch i386 -arch ppc -pipe"

./configure --prefix=/usr/X11 --with-mesa-source=`pwd`/../Mesa-7.0.4 --disable-dependency-tracking
sudo make install

To build and install Xvfb, Xnest, Xephyr, and Xfake instead of Xquartz/, you will need to add the following options to configure. Note that it is currently not possible to build these components at the same time as Xquartz due to how we currently start the Xquartz server (see dix/main.c and look for the #ifdef XQUARTZ). A solution to this is currently being sought.

--disable-xquartz --enable-xvfb --enable-xnest --enable-kdrive

Other Packages

Most upstream packages (other than xserver) can be rebuilt and reinstalled if necessary (new versions, etc) by a means common to moth UNIX developers:

tar xjf <package>-<version>.tar.bz2
cd <package>-<version>

export PKG_CONFIG_PATH="/usr/X11/lib/pkgconfig:${PKG_CONFIG_PATH}"
export ACLOCAL="aclocal -I /usr/X11/share/aclocal"

export CFLAGS="-Wall -O2 -arch i386 -arch ppc -pipe"
export LDFLAGS="-Wall -O2 -arch i386 -arch ppc -pipe"

./configure --prefix=/usr/X11 --disable-dependency-tracking
sudo make install

Some packages require special configure options or CFLAGS, but there are few in this category, and they are being fixed. To see what configure options, versions, or extra patches were used in Apple's official releases, check out Apple's Open-Source Repository for 10.5.

Alternate Prefixes

Recent changes have added support for installing outside the /usr/X11 location for the system X11. X11-2.4.1 for SnowLeopard installs to /opt/X11. To duplicate this environment, you will need to use the following configure options:

All Packages: --prefix=/opt/X11
xorg-server and xinit: --with-launchd-id-prefix=org.macosforge.xquartz
xorg-server: --with-apple-application-name=XQuartz 


All of our development is done using the Git version control system.

Using Git has additional documentaion for general git workflow and submitting patches.

Initial setup

1) Clone the repository and create local branches to track changes made in the repository:

git clone git://
cd xserver
git remote add fdo git://
git branch --track server-1.4-apple origin/xorg-server-1.4-apple
git branch --track server-1.5-apple origin/xorg-server-1.5-apple
git branch --track server-1.6-apple origin/xorg-server-1.6-apple
git branch --track server-1.7-apple origin/xorg-server-1.7-apple
git branch --track server-1.8-apple origin/xorg-server-1.8-apple
git branch --track server-1.9-apple origin/xorg-server-1.9-apple
git branch --track server-1.10-apple origin/xorg-server-1.10-apple

2) Switch to the branch you wish to develop on:

git checkout -f server-1.10-apple

3) You can then compile and install the server as described in the directions above. You will just need to use './' instead of './configure' the first time you configure the server.

Local Changes

During your development, you'll reach a point where you want to commit changes to git. First, you must commit these changes to your local branch:

git commit -as

These changes are stored locally and you can use diff git diff to prune out specific change sets (to be emailed to xquartz-dev for example).

Remote Changes

You will need to pull in changes from the master repository (this is like cvs/svn update). If you have made local changes, you need to be careful to do a git fetch and git rebase and NOT git pull. As a safety precaution, you should just forget that git pull even exists. git rebase causes your local changes to be backed out then re-applied after upstream changes. If any conflicts arise, you can use git mergetool to resolve them.

git fetch
git rebase origin/server-1.10-apple

If you have a recent enough version of git, you can simplify this by doing:

git pull --rebase

Submitting Changes

You can submit patches of your changes to the xquartz-dev mailing list. To generate a series of patches, you can use git format-patch. For example, if you want to create a series of patches and are developing against server-1.10-apple, you would do:

git format-patch origin/server-1.10-apple

git diff

git diff is VERY helpful. It can be used to see changes between branches or different states in a single branch. It can report the differences for the entire tree (default) or just a specific sub-directory or file. The main use of it is:

git diff <start commit-ish> <end commit-ish> [<file or dir>]

Here are some examples:

git log reports the following:

commit 8a079be0dd0f2ce37868988cde4ac8895522b088
Author: Jeremy Huddleston <jeremy@yuffie.local>
Date:   Thu Nov 29 02:19:22 2007 -0800

    Darwin: #ifdefs around dix-config.h include and NDEBUG/assert.h workaround.
    (cherry picked from commit d2b768890f0878ae4e3fec8f7219e82b79256133)

commit 38397560612424b5b348f34c1a0bea8c47a574be
Author: Jeremy Huddleston <jeremy@yuffie.local>
Date:   Wed Nov 28 23:07:41 2007 -0800

    Darwin: Removed support for darwinSwapAltMeta
    (cherry picked from commit 3d153c8fa40986d194b7701f5eafa0080e32399a)

If I want to generate a patch for the 'Darwin: #ifdefs around dix-config.h...' changes, I would do the following:

git diff 38397560612424b5b348f34c1a0bea8c47a574be 8a079be0dd0f2ce37868988cde4ac8895522b088

If I want to see how the file 'darwin.c' changed between the xorg-server-1.2-apple and xorg-server-1.4-apple branches, I would do the following:

git diff xorg-server-1.2-apple xorg-server-1.4-apple darwin.c

New Branch Creation

If you need to create a new branch in the upstream repository, you can follow this example which creates a new xorg-server-1.6-apple branch based off the server-1.6 branch:

git checkout -b xorg-server-1.6-apple origin/server-1.6-branch
git push origin xorg-server-1.6-apple:refs/heads/xorg-server-1.6-apple

Branch Status

This summarizes the status of our components in the xserver git repository. This means mainly miext/rootless, GL/apple, and hw/darwin.

xorg-server-1.2-apple (Old Stable)

This branch is based off of the server-1.3 branch (which itself is based off of the server-1.2 branch) with changes specific for Xquartz. It is the branch for the 2.1.x and 2.2.x releases and will not see any further development.

server-1.4-apple (Old Stable, Maintained)

This branch is based off of the server-1.4 branch with changes specific for Xquartz. This is the branch for the 2.3.x releases and is the branch shipped with the latest Leopard and SnowLeopard OS.

server-1.5-apple (Old Stable)

The Xquartz specific code in 1.5 is almost identical to what is in 1.4. The main exception is GLX and input handling. This branch was used in the 2.4.x releases.

server-1.6-apple (Old Stable)

This branch was used in the later 2.4.x releases.

server-1.7-apple (Old Stable)

This branch was used in earlier 2.5.x releases.

server-1.8-apple (Stable)

This branch was used in later 2.5.x releases.

server-1.9-apple (Release)

This branch will be used in early 2.6.x releases.

server-1.10-apple (Development)

This branch will be used in later 2.6.x releases.

master (Development)

This branch contains fixes that will be merged into mainline master (ie: a subset of what is on server-1.10-apple).