Skip to content

Build instructions for Ubuntu

Philipp Lutz edited this page Nov 28, 2024 · 7 revisions

See also the old version migrated from redmine: Building-darktable

Install prerequisites

The following code snippet is essentially equivalent to opening the "Software & Updates" program, selecting the "Source code" checkbox, hitting the "Update" button, running sudo apt-get build-dep darktable, and finally deselecting the "Source code" checkbox. All lines must be pasted at once into a terminal.

sed -e '/^#\sdeb-src /s/^# *//;t;d' "/etc/apt/sources.list" \
| sudo tee /etc/apt/sources.list.d/darktable-sources-tmp.list > /dev/null \
  && (    sudo apt-get update \
       && sudo apt-get build-dep darktable \
  ); sudo rm /etc/apt/sources.list.d/darktable-sources-tmp.list

Alternatively, you can install the required packages with:

sudo apt install cmake llvm clang clang-tools intltool xsltproc libsaxon-java libxml2-utils libimage-exiftool-perl zlib1g-dev libpugixml-dev libjpeg-dev libglib2.0-dev libgtk-3-dev libxml2-dev libsqlite3-dev librsvg2-dev libcurl4-openssl-dev libtiff-dev liblcms2-dev libjson-glib-dev libexiv2-dev

And some useful optional packages with:

sudo apt install libgphoto2-dev liblensfun-dev libgmic-dev libcolord-dev libcolord-gtk-dev libgraphicsmagick1-dev liblua5.4-dev libedit-dev libimath-dev libavif-dev libportmidi-dev libopenjp2-7-dev libsecret-1-dev libsdl2-dev libopenexr-dev libosmgpsmap-1.0-dev libcups2-dev

(This has been tested with Ubuntu 24.04 and Darktable 4.7.)

Download and extract the latest release

Since perl is guaranteed to be installed, we can use it to download the latest release. The DT_VER environment variable is only for the purposes of these installation commands, so that the version can be adjusted in a single place.

DT_VER=3.0.0

perl -e "use LWP::Simple; getstore( \
  'https://github.com/darktable-org/darktable/releases/download/release-$DT_VER/darktable-$DT_VER.tar.xz', \
  '$HOME/Downloads/darktable-$DT_VER.tar.xz');"

cd ~/Downloads && tar xvf darktable-$DT_VER.tar.xz && rm darktable-$DT_VER.tar.xz && cd darktable-$DT_VER

Build

./build.sh

Install

sudo cmake --build "/home/user/Downloads/darktable-$DT_VER/build" --target install -- -j8

Create a link for the program shortcut and corresponding icon.

sudo ln -s /opt/darktable/share/applications/darktable.desktop /usr/share/applications/darktable.desktop
sudo ln -s /opt/darktable/share/icons/hicolor/scalable/apps/darktable.svg /usr/share/pixmaps/darktable.svg

Now you should be able to run Darktable from the program shortcut, or from the command line via

/opt/darktable/bin/darktable

In order to add darktable to the path so that the prefix /opt/darktable/bin/ is unnecessary, run

export PATH="/opt/darktable/bin:$PATH"

In order to set the prefix automatically, after your next login, run

echo export PATH=\"/opt/darktable/bin:\$PATH\" >> ~/.profile

Uninstall

To uninstall Darktable, it suffices to delete /opt/darktable-x.y.z and the links:

sudo rm -rf /opt/darktable-x.y.z
sudo rm /usr/share/applications/darktable.desktop
sudo rm /usr/share/pixmaps/darktable.svg

User-level configuration data is stored in ~/.config/darktable.

Note: this does not uninstall the prerequisites downloaded at the beginning.