Did you know ... Search Documentation:
SWI-Prolog owl logoBuilding SWI-Prolog on MacOS (Lion and Snow Lion)

Last updated: June 17, 2013, homebrew

Using Macports

Building SWI-Prolog for MacOS requires Macports. In general, the Portfiles are kept nicely up-to-date thanks to Paulo Moura. If you are a Macport user, SWI-Prolog can be installed simply using one of the commands below. The first installs the `stable' version and the second the `development' version. Note that most of the time developers are better of using the development version.

port install swi-prolog
port install swi-prolog-devel

If you like to keep nice and lean system (i.e., if you do not want Macports copies of X11, ODBC, etc), you still need to install several prerequisites. First:

  1. Xcode (can be installed as a free app from the appstore)
  2. Macports (download from http://www.macports.org/)
  3. X11. This is an OS option for Lion (10.7) and must be installed from http://xquartz.macosforge.org/landing/ for Mountain Lion (10.8).

Next, you must install the following Macport libraries:

port install gmp jpeg libarchive libiconv libmcrypt ncurses \
             openssl ossp-uuid pkgconfig readline zlib

Next, you can download SWI-Prolog as a source archive or using GIT and build it using the build script as follows:

cp build.templ build
<edit build, following comments>
./build

Using Homebrew

Homebrew provides an alternative to Macports. The command below installs the latest stable version of SWI-Prolog:

brew install swi-prolog

The latest git version of SWI-Prolog can be installed with this command:

brew install swi-prolog --HEAD

(contributed by Rinke Hoekstra)

See also
- The Portfile
- The scripts for building a binary release as distributed through our download pages are available in a git repository. Use
git clone git://www.swi-prolog.org/home/pl/git/misc/macos-build.git