Gimp Building Tips (for Linux)

Updated for Ubuntu Precise Pangolin and GIMP 2.9 as of Feb 2013. For earlier versions, see gimpbuild-2011 and gimpbuild-2009.

For building GIMP 2.7 on Mac, see Tim Chen's page: Build GIMP on Mac.

For building GIMP 2.7 on Windows, see How to build GIMP 2.7.5 using MinGW in Windows 32-bits.

GIMP has a fair number of dependencies, which can seem intimidating the first time you try to build it. Although configure is usually clear about what's missing, that's not always helpful in figuring out what package you need to add on a particular distro. The git instructions might also be helpful to anyone who hasn't used git very much yet.

If you want to build the latest GIMP but also keep another version, like the one from your distro, it's very important to include the --prefix argument when running autogen.sh or configure. Otherwise GIMP will end up installed to /usr/local/bin and all of your GIMP versions may get confused about which set of libraries applies to which binary. You may also want a wrapper script (see below) to set up the library paths appropriately.

Building GIMP from git on Ubuntu Natty

Natty has most of the dependencies, but you'll still need to get glib-2.30.2, as well as the git versions of babl and gegl. On Lucid or Maverick, you'll also need recent versions of the other packages like gtk, cairo and friends (see below).

Install GIT and other build dependencies

Install the GIMP build dependencies:

sudo apt-get build-dep gimp libglib2.0-0 libtool ruby
(note: ruby is needed for the gegl build if you're building from git).

Depending on what options you want, you might also want some other packages, such as: libopenraw1 libopenraw-dev libgexiv2-dev libgexiv2-0 graphviz libgraphviz-dev

Install GIT. You might think the package named "git" would be the right one, but don't bother with it -- on Ubuntu Lucid it just installs some documentation, not the actual git program. (This seems to have changed in Natty.)

sudo apt-get install git-core git-doc git-email
I installed "git-doc" and "git-email" too, though they're probably not needed.

Configure git (this comes from GitDevelopers on Gnome Live):

git config --global user.name "Your Name"
git config --global user.email you@host

Set up your install prefix

Decide on where you're going to put the installed files. By default, the packages will install to /usr/local, but that will cause conflicts with the older version of GIMP already installed on your machine. If you want to keep two or more GIMP versions available, you need to choose an install "prefix". For example, I use /usr/local/gimp-git. It's okay to put all the gimp-related packages in one prefix -- you don't need a separate prefix for each package.

If you're building on a system used only by you, you might want to consider using a prefix in your home directory, e.g. --prefix=/home/yourname/gimp-git. That way, you can run make install without needing to be root (in that case, omit the sudo in the lines below).

Set up your PKG_CONFIG_PATH to point to this prefix, otherwise gegl won't be able to find babl and gimp won't find either one of them. The easiest way to do this is to create the prefix, create a share directory inside it, then create a config.site file there containing lines like these:

export PKG_CONFIG_PATH="/usr/local/gimp-git/lib/pkgconfig:$PKG_CONFIG_PATH"
export LD_LIBRARY_PATH="/usr/local/gimp-git/lib:$LD_LIBRARY_PATH"
If you choose, you can also set options like CFLAGS, ACLOCAL_FLAGS, etc.

Download the prerequisites

As of Feb 2013 and Pangolin, GIMP needs

I think that's all I needed this time.

Build the prereqs

All these packages are build the same way:

$ tar xvf filename.tar.bz2 (or gz)
$ cd dirname
$ ./configure --prefix=/usr/local/gimp-git
    (or your choice of prefix)
$ make
$ sudo make install

If you have a modern multi-core system, adding a -jN flag to the make line will speed things up. Try make -j4. (People argue incessantly about the best number to use after -j, but it seems to vary from one system to the next. It's not critical.)

Then you're ready to start checking out the git versions of the GIMP-specific packages.

Check out the GIMP-related packages

You'll need babl and gegl as well as gimp. Here's how to get all three:

git clone git://git.gnome.org/babl
git clone git://git.gnome.org/gegl
git clone git://git.gnome.org/gimp
Or if you have a Gnome developer account:
git clone ssh://user@git.gnome.org/git/babl
git clone ssh://user@git.gnome.org/git/gegl
git clone ssh://user@git.gnome.org/git/gimp

Configure (autogen.sh) and build

Now build everything. The first time, you'll need to run autogen.sh in each directory and specify your prefix and any other configure options you might want. Later, when you update with git pull, you can just type make and make will re-run configure with the proper prefix.

cd babl
./autogen.sh --prefix=/usr/local/gimp-git
make
sudo make install

cd ../gegl
./autogen.sh --prefix=/usr/local/gimp-git
make
sudo make install

cd gimp
./autogen.sh --prefix=/usr/local/gimp-git --disable-gtk-doc
(review all the "no" answers and decide if you need to install anything else and re-run autogen. Installing libwebkit-dev won't help you get gimp-help, though; it wants a much newer version than what Jaunty has.)
make
sudo make install

Done! Your new gimp should be in /usr/local/gimp-git/bin/gimp.

Wrapper script

One more thing: if you have a distro-installed GIMP too, you may find it helps to have a wrapper script that ensures you're using the right libraries. Otherwise, GIMP and any plug-ins it runs can get confused and exhibit weird behavior.

Here's the script I use, which I install in ~/bin/gimp-git, and then I make a link to it named gimptool-git. I'm sure this could be improved, but it seems to work.

#!/bin/sh

progname=$(basename $0)
if [ $progname = 'gimptool-git' ]; then
  progname=gimptool-2.0
fi

GIMPLOC=/usr/local/gimp-git
export PATH=$GIMPLOC/bin:$PATH
export LD_LIBRARY_PATH=$GIMPLOC/lib

$GIMPLOC/bin/$progname $*

Older distros and older GIMP versions

If you're building an old tarball on an older Linux distro, you might want gimpbuild-2009 or even older gimp building instructions.


My book: Beginning GIMP, from Novice to Professional
Linux Imaging
General Linux links
Shallow Sky home
...Akkana