News: Primary git repository moved to GitHubSearch Documentation:
SWI-Prolog owl logoCreating and submitting extension packages for SWI-Prolog

What is a pack?

A pack is an archive (.zip or .tgz) file that (minimally) contains, two items:

A subdirectory prolog
If the pack is installed, this directory is added to the Prolog library. This directory contains Prolog files using the extension .pl.
A file
This file provides meta-data for the pack.

Creating a pack that uses C or C++ code is described here

Creating a pack

A pack is created by creating the a directory with the name of the pack and filling it with the content described above. Next, create an archive, which is either a gzipped tar file or a zip file from the file that must be named <pack>-<version>.tgz or <pack>-<version>.zip, where version is a list of digits, separated by dots (.). For example:

% tar zcvf mypack-1.0.tgz mypack


% zip -r mypack

Test the pack

The pack may be installed using pack_install/1 as illustrated below.

?- pack_install('mypack-1.0.tgz').

Make the pack available

To make the pack available, it must be downloadable from a publicably available HTTP server. To support package upgrading, the HTTP server must have enabled fetching an index of the directory. I.e., if the pack is located at, fetching must return an HTML document with links to available package files.

After uploaded the package to e.g.,, it is made available to other users simply by installing it yourself:

?- pack_install('').

After this, other people can install your package simply using

?- pack_install(mypack).

Do's and Don'ts

To make packages work smoothly, package submitters need to take care of some rules:

  • Use a meaningful name for your package that is not likely to conflict. Check to verify there is no name conflict.
  • All files in the prolog directory must be Prolog module files. Use names for the module files that are not likely to conflict with others.
  • Use consistent version numbers (e.g. 0.1, 0.2 ..., 1.0). Versions are compared by turning the version id into a list of integers that is compared using compare/3. Make sure that the version in matches the version encoded in the archive name.
See also
- PackInfo.txt for a description of
- ForeignPack.txt for creating packs with C or C++ code
- list of submitted packages
- library(prolog_pack) for predicates to query, install and remove packs
- Status and TODO