Mac OS X

Compiling Photivo

Below are kwip’s steps to build Photivo on a Mac. Note that the steps below are not relying on MacPorts or Fink and will not work if MacPorts or Fink are found in your PATH. If you are using MacPorts or Fink, creating a new User for the build process will be the best way.

DJ Joofa built the first Mac version. It is superseeded by kwip’s build now, but his build approach still contains valuable information and can be found on the Mac (archival) page.

Tools needed

Xcode, which is the gcc framework on Mac platform, is needed for compilation. Xcode is available on the Mac Os X installation CD. Additionally a more recent compiler is needed as gcc shipped with Xcode does not handle OpenMP properly, I'd recomment gcc 4.6 (c,c++,objc as languages are sufficient)

Libs needed

The following frameworks from Qt are needed, I'd recommend to stick with the official Framework:

  • QtCore
  • QtGui
  • QtNetwork

Following open source libraries are needed:

  • libGraphicsMagic++
  • libGraphicsMagic
  • libGraphicsMagicWand
  • libexiv2
  • libfftw3
  • libglib-2.0
  • libiconv
  • libintl
  • liblcms2
  • liblensfun
  • libjpeg
  • libtiff
  • libpng

Follow the same instructions for compiling GrapicsMagick as listed in the Linux section on Photivo website at Linux

./configure --prefix=/usr --with-quantum-depth=16 --enable-shared

Building the gcc

To have a recent compiler follow the instructions on the GNU GCC site. I installed it to /opt/local.

./configure --prefix=/opt/local --with-gmp-include=/opt/local/include --with-gmp-lib=/opt/local/lib --with-mpfr-include=/opt/local/include --with-mpfr-lib=/opt/local/lib --with-mpc-include=/opt/local/include --with-mpc-lib=/opt/local/lib --enable-languages=c++,c,objc

Please symlink c++,cpp,g++,gcc and gcov to /usr/bin yielding:

/usr/bin/c++ -> /opt/local/bin/c++
/usr/bin/cpp -> /opt/local/bin/cpp
/usr/bin/g++ -> /opt/local/bin/g++
/usr/bin/gcc -> /opt/local/bin/gcc
/usr/bin/gcov -> /opt/local/bin/gcov

Building the prerequisites

Most of the prerequisites can be built via gtk-osx. Due to the fact you are using gcc4.6 now, the mac-specific "-arch"-flags are not supported anymore. You will have to open all ~/.jhbuild-* files and replace "-arch x86_64" by "-m64" and "-arch i386" by "-m32". After these changes and by thoroughly following the build instructions of the “Building GTK-OSX” guide everything should compile without any hassles.

Most of the needed libs are built now and will reside in ~/gtk/inst

now you have to compile

  • libGraphicsMagick
  • libexiv2
  • libfftw3
  • liblcms2
  • liblensfun
  • libjpeg
  • libtiff
  • libpng

Please use the most recent sources and don't mix up GraphicsMagick and ImageMagick as I did ;).

libGraphicsMagick will be the last library built. For most of the libs I used (please expand ~ to an absolute path, i.e. /Users/you/gtk/inst):

./configure  --prefix=~/gtk/inst --enable-shared  --disable-static

For libGraphicsMagick please use:

./configure  --prefix=~/gtk/inst --enable-shared --disable-static --without-x --without-bzlib --without-zlib --without-xml --with-quantum-depth=16

to enable 16-bit and remove unneeded dependencies (especially x). Make sure it finds png, jpg and tiff headers. If not, please symlink them to /usr/include/

Building the Projects


If pkg-config can’t locate some of the required packages, then define the PKG_CONFIG_PATH variable to specify additional paths. Run

qmake-4.7 -spec macx-g++

and it shall generate all Makefiles.


now simply run make

Running Photivo

At this stage, after compilation, photivo is ready to be run. Just navigate to the directory containing and execute it.

Assembling the redistributable package

The following informations are mainly copied from DJ Joofas build process. Those where the key informations to get a proper Mac bundle. So please say thanks to him!!

Mac OS X applications follow a certain directory structure. There is some freedom available in arranging different items. I assembled the using the following structure:

The Frameworks directory basically contains the following files:


Note: The default QtCore and QtGui frameworks have include files and debug libraries embedded in them, which are not required for redistribution with photovio. However, they increase the size of these frameworks substantially. I manually stripped them off to reduce the size. The MacOS directory contains the main photivo executable with some handy links:


The support files needed by photivo during runtime are put in a directory data inside the Resources directory:


Runtime linking of Frameworks and Dynamic Libraries

The information regarding the frameworks and dynamic libraries needed by photivo at runtime are stored as pointers in the executable as revealed by the otool command. The following structure was put in the main photivo executable.

otool -L photivo
@executable_path/../lib/libjpeg.62.dylib (compatibility version 63.0.0, current version 63.0.0)
@executable_path/../lib/liblcms2.2.dylib (compatibility version 3.0.0, current version 3.0.0)
@executable_path/../lib/libexiv2.9.dylib (compatibility version 10.0.0, current version 10.0.0)
@executable_path/../lib/libfftw3.3.dylib (compatibility version 6.0.0, current version 6.4.0)
@executable_path/../lib/libglib-2.0.0.dylib (compatibility version 2401.0.0, current version 2401.0.0)
@executable_path/../lib/liblensfun.dylib (compatibility version 0.0.0, current version 0.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.2.1)
@executable_path/../lib/libGraphicsMagick++.3.dylib (compatibility version 7.0.0, current version 7.0.0)
@executable_path/../lib/libGraphicsMagickWand.2.dylib (compatibility version 5.0.0, current version 5.0.0)
@executable_path/../lib/libGraphicsMagick.3.dylib (compatibility version 10.0.0, current version 10.0.0)
@executable_path/../Frameworks/QtGui.framework/Versions/4/QtGui (compatibility version 4.7.0, current version 4.7.0)
@executable_path/../Frameworks/QtCore.framework/Versions/4/QtCore (compatibility version 4.7.0, current version 4.7.0)
/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.9.0)
/usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 625.0.0)

Note: A structure similar to the above needs to be put in all files contained in the Frameworks and lib directories in the

All these changes have to be carried out each time photivo is compiled. Here, macdeployqt comes in handy which ist shipped with qt. It changes all libs and paths appropriately.

What is missing, is the desired directory structure. I was using a simple script provided in the following. It can be run to build and bundle photivo.

rm -rf
mkdir ./
cp -R ChannelMixers Profiles Presets LensfunDatabase Icons Curves ./
mkdir ./
cp *.png ./
ln -s ../Resources/data/* .
unlink images
ln -s ../Resources/data/images/* .
cd -
install_name_tool -change liblensfun.dylib ~/gtk/inst/lib/liblensfun.dylib
cp photivo-appicon.icns ./
cp Info.plist ./
macdeployqt -dmg
#rm -rf /Applications/
#cp -R /Applications/

That's it, a photivo package ready for deployment.