Did you know ... Search Documentation:
SWI-Prolog -- Installation on Linux, *BSD (Unix)

Installing from binaries

The official packages are often out of date. PPAs are created automatically for every release. PPAs are available for Ubuntu by following directions on the PPA page.

Installing from source

Installing from source is often the best option for installing on Linux and *BSD based systems. Building is not complex. This document describes building 7.7.20 or later using cmake. See this page for building older versions using GNU autoconf and make.

Downloading SWI-Prolog

Download the SWI-Prolog source

Preparing the source (when downloading using GIT)

The tar ball is self contained. The GIT repository contains sub modules. The git repository is downloaded (cloned) using the commands below:

git clone https://github.com/SWI-Prolog/swipl-devel.git
cd swipl-devel
git submodule update --init

Similarly, the sequence to update the source using git and rebuild is

cd swipl-devel
git pull
git submodule update --init

Getting the prerequisites

Building SWI-Prolog from source requires tools as well as libraries. We maintain pages that describes the required dependencies by platform. The last entry of the list below describes the dependencies in platform independent way.

Building using cmake

Using cmake the system is typically build in a subdirectory of the downloaded sources. The build system does not add or modify any file in the source tree and (thus) multiple subdirectories can be created holding different configurations. A built system can simply be removed by removing the build directory. Basic instruction to build the system to be installed in `/usr/local` are:

cd swipl-devel
mkdir build
cd build
cmake ..
make
sudo make install

A full description for installing a particular configuration in a particular location, dealing with development workflows, etc. can be found in the file CMAKE.md

Post installation (JPL)

If you want to call Java from Prolog using JPL, you need to add the directory holding the JVM shared objects to the dynamic linker search path. Using default installation on Ubuntu, this is achieved by adding the following to your ~/.profile. Check your Java configuration to find the exact path.

LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/jvm/java-1.8.0-openjdk-amd64/jre/lib/amd64/server