Table of Contents

Instructions for downloading and installing binaries for different Operative systems instructions and additional notes and corrections not included in this documentation can be found in Installation wiki

To use pgRouting postGIS needs to be installed, please read the information about installation in this Install Guide

Short Version

Extracting the tar ball

tar xvfz pgrouting-3.1.4.tar.gz
cd pgrouting-3.1.4

To compile assuming you have all the dependencies in your search path:

mkdir build
cd build
cmake  ..
sudo make install

Once pgRouting is installed, it needs to be enabled in each individual database you want to use it in.

createdb routing
psql routing -c 'CREATE EXTENSION PostGIS'
psql routing -c 'CREATE EXTENSION pgRouting'

Get the sources

The pgRouting latest release can be found in


To download this release:

wget -O pgrouting-3.1.4.tar.gz

Goto Short Version to the extract and compile instructions.


To download the repository

git clone git://
cd pgrouting
git checkout v3.1.4

Goto Short Version to the compile instructions (there is no tar ball).

Enabling and upgrading in the database

Enabling the database

pgRouting is an extension and depends on postGIS. Enabling postGIS before enabling pgRouting in the database


Upgrading the database

To upgrade pgRouting in the database to version 3.1.4 use the following command:

ALTER EXTENSION pgrouting UPDATE TO "3.1.4";

More information can be found in


Compilation Dependencies

To be able to compile pgRouting, make sure that the following dependencies are met:

  • C and C++0x compilers * g++ version >= 4.8
  • Postgresql version >= 9.3
  • The Boost Graph Library (BGL). Version >= 1.53
  • CMake >= 3.2

optional dependencies

For user’s documentation

  • Sphinx >= 1.1
  • Latex

For developer’s documentation

  • Doxygen >= 1.7

For testing

  • pgtap
  • pg_prove

For using:

  • PostGIS version >= 2.2

Example: Installing dependencies on linux

Installing the compilation dependencies

Database dependencies

sudo apt-get install
    postgresql-10 \
    postgresql-server-dev-10 \

Build dependencies

sudo apt-get install
    cmake \
    g++ \

Optional dependencies

For documentation and testing

sudo apt-get install -y python-sphinx \
    texlive \
    doxygen \
    libtap-parser-sourcehandler-pgtap-perl \


pgRouting uses the cmake system to do the configuration.

The build directory is different from the source directory

Create the build directory

$ mkdir build

Configurable variables

To see the variables that can be configured

$ cd build
$ cmake -L ..

Configuring The Documentation

Most of the effort of the documentation has being on the HTML files. Some variables for the documentation:

Variable Default Comment
WITH_DOC BOOL=OFF Turn on/off building the documentation
BUILD_HTML BOOL=ON If ON, turn on/off building HTML for user’s documentation
BUILD_DOXY BOOL=ON If ON, turn on/off building HTML for developer’s documentation
BUILD_LATEX BOOL=OFF If ON, turn on/off building PDF
BUILD_MAN BOOL=OFF If ON, turn on/off building MAN pages
DOC_USE_BOOTSTRAP BOOL=OFF If ON, use sphinx-bootstrap for HTML pages of the users documentation

Configuring with documentation

$ cmake -DWITH_DOC=ON ..


Most of the effort of the documentation has being on the html files.


Using make to build the code and the documentation

The following instructions start from path/to/pgrouting/build

$ make          # build the code but not the documentation
$ make doc      # build only the documentation
$ make all doc  # build both the code and the documentation

We have tested on several platforms, For installing or reinstalling all the steps are needed.


The sql signatures are configured and build in the cmake command.

MinGW on Windows

$ mkdir build
$ cd build
$ cmake -G"MSYS Makefiles" ..
$ make
$ make install


The following instructions start from path/to/pgrouting

mkdir build
cd build
cmake  ..
sudo make install

When the configuration changes:

rm -rf build

and start the build process as mentioned above.


Currently there is no make test and testing is done as follows

The following instructions start from path/to/pgrouting/

createdb  -U <user> ___pgr___test___
sh ./tools/testers/ <user>
dropdb  -U <user> ___pgr___test___

See Also

Indices and tables