How to build GIMP on mac OS X

Building GIMP and all its dependencies from source takes quite a bit of time (at least a few hours), but fortunately it's generally not difficult.

Simone has created an alternative way to for creating a GIMP Package on your Mac. The trick is to compile all the MacPorts stuff under a special location, /tmp/slk/, and then the launch scripts just recreate /tmp/slk as a symlink before launching. Thus you can move the app wherever you want, it will just re-create the symlink accordingly and still work. This has the result that no shell-variables have to be set like in the former That makes your Gimp less vulnerable to errors.

You will also need to install Developer Tools from Apple (or your OS X install disk) if not already done. Make sure to update to the latest version (for instance Xcode 2.2 is known to have problems that are fixed by upgrading to 2.5).

What needs to be done once

Install MacPorts

The first step is to build a special copy of macports with the new location built-in. Before doing this, be very careful to remove/move any references to any older macports install you had (e.g. sudo mv /opt/local /opt/local-disabled) otherwise you might find yourself in the uneasy situation where what you install is a mix and match of libraries from both locations. (If you have installed lots of stuff in /usr/local it might be a good idea to do the same with that prefix too, and not move them back until the very end of the build.) It might also be a good idea to remove ~/.macports so you really have a clean install.

First of all create a folder src/macports in your home-folder and untar the MacPorts Source into it.

mkdir -p ~/src/macports
cd ~/src/macports

Then we create the symlink that bridge everything. Note we are creating it in /tmp, this means that if you log out or shut down your computer it will be erased. If you need to interrupt the build and shut your computer, you will need to re-create it next time, before you can continue building.

rm -f /tmp/skl/
mkdir -p /tmp/skl
cd /tmp/skl
ln -s ~/src/macports/
cd -

Go to the MacPorts-Source-Folder and compile and install it.

(On Tiger, X11 is instead under /usr/X11R6/lib therefore you might want to adapt the path there) cd MacPorts
export MACPORTS=/tmp/skl/
./configure --prefix=$MACPORTS LDFLAGS=-L/usr/X11/lib
sudo make install

Checkout our files from SVN

Get our app skeleton via Subversion (get subversion installers for mac here).

(The "svn checkout" command needs to be done only once, after this simply cd into the directory and issue "svn update". Don't forget to update the skeleton everytime you build, to get latest fixes)

cd /where/you/want/it
svn checkout darwingimp

What needs to be done every time

If you have not already done it previously (above), create the symlink. (see above for more info. it is important that the symlink is correctly set-up whenever you build.)

rm -f /tmp/skl/
mkdir -p /tmp/skl
cd /tmp/skl
ln -s ~/src/macports/
cd -

Ask macports to update itself, to get information about latest software :
sudo ~/src/macports/ -d selfupdate

The GIMP portfile will be located at this location, should we ever need to manually update it to a newer version (always check the forum to know whether such a manual update is necessary. there will usually be a thread associated with each GIMP release) ~/src/macports/

Build Gimp

Simply do the following to install GIMP and its dependencies :

sudo ~/src/macports/ -d install gimp2 +x11
sudo ~/src/macports/ -d install gimp-lqr-plugin
sudo ~/src/macports/ -d install icns-gimp
sudo ~/src/macports/ -d install ufraw
sudo ~/src/macports/ -d install gutenprint
sudo ~/src/macports/ -d install ghostscript
sudo ~/src/macports/ -d install macclipboard-gimp

Warning : do not open an existing GIMP application while macports is building stuff, doing so will change the symlink and mess up your build.

Possible problem

If you meet the following problem :

---> Activating p5-getopt-long 2.37_0
Error: Target org.macports.activate returned: Image error: /tmp/skl/ is being used by the active perl5.8 port. Please deactivate this port first, or use the -f flag to force the activation.
Warning: the following items did not execute (for p5-getopt-long): org.macports.activate

run the following command :
sudo ~/src/macports/ -f activate p5-getopt-long
then run the gimp2 +x11 one again and you should be able to continue your build. Alternatively, it was reported that just issuing the gimp2 +x11 command repeatedly eventually got it to work.


Macports has a nasty tendency of screwing up ghostscript (what reads poscript/eps files) so before continuing we will test its installation, and on failure fix it manually

Issue this command on the terminal :

/tmp/skl/ --version

If it prints the current version number as expected, your installation is fine and you can continue to the next step. If, however, it fails because of some missing or incompatible library, you'll need to manually fix ghostscript.

Download the ghostscript source code here (e.g. GPL Ghostscript 8.62), then build and install it using the commands below. Before continuing, make sure your /tmp/skl symlink is still properly setup.

cd /path/to/ghostscript-8.62
export PKG_CONFIG_PATH=/tmp/skl/
./configure --prefix=/tmp/skl/
sudo make install


Let's go back in the SVN checkout you did earlier and prepare to package.

cd path/to/darwingimp
svn up
cd skeleton
Enter your password when it is requested.

Now the output directory is ready, we'll let the script finish the packaging.

cd output

The script will copy all the files from your Macports Installation into the Gimp-skeleton. Then it's time to make a dmg.

cd ..


Your Gimp-build is done and ready to run. The resulting binary will be located in the output directory. A dmg will have been generated in the skeleton directory. This DMG is ready to be uploaded and distributed (just replace VERSION in its name with the current GIMP version). Feel free to contact us at our website.

Thanks again to Simone for her instructions.

Sources: and Howto. Logo