I have installed osm2pgrouting on my Ubuntu 12.04 server with the following code from this tutorial:

sudo add-apt-repository ppa:georepublic/pgrouting-unstable
sudo apt-get update
sudo apt-get install osm2pgrouting

Which ran happily. Unfortunately however, when I go to use osm2pgrouting at the command line, the tool is missing. I realise I could follow the instructions on github but I was hoping to get an easy sudo apt-get install working out of the box.

Thus, how can I get this tool working at the command line? I suspect it is something to do with paths...

  • 1
    what does locate osm2pgrouting print?
    – til_b
    Nov 29, 2013 at 10:46
  • Same problem here... apt-get does not work.. > locate osm2pgrouting doesn't print anything (where is the file???)
    – user24485
    Nov 29, 2013 at 17:50

2 Answers 2


Should be here: /usr/share/bin/osm2pgrouting

See also: https://github.com/pgRouting/osm2pgrouting/blob/master/CMakeLists.txt

But particularly if you are dealing with large data (e.g. europe.osm) you might want to try osm2po instead of osm2pgrouting.


Here's how I got this working (on Linux Mint, which has worked for everything I've done on Ubuntu)

Dependencies for building the install:

Install cmake

sudo apt-get install build-essential -y

Install boost

sudo apt-get install libboost-all-dev

Install expat

sudo apt-get install expat libexpat1-dev

Install libpqf (if necessary)

sudo apt-get install libpq-dev

Once you've got that going, the "installation" found on the osm2pgrouting github page work just fine:

cmake -H. -Bbuild
cd build/
make install

To run the tool, it seems you have to be in the directory mentioned in the other answer, which you can get to with:

cd /usr/share/bin

Now the command on the github page is different than the command on the official PGRouting Page, which combined with the github code, is based on this command:

./osm2pgrouting -file your-OSM-XML-File.osm -conf mapconfig.xml -dbname routing -user postgres -clean

My command looked like:

./osm2pgrouting -file ~/Documents/pgrouting/osm2pgrouting-master/denver-boulder_colorado.osm -conf ~/Documents/pgrouting/osm2pgrouting-master/mapconfig.xml -host localhost -dbname postgres -user matthew -clean

Notice I also had to specify the path to the mapconfig.xml file...

So when the command is run and all is said and done the message you should get look something like this:

Create Topology success
size of streets: 154076
size of splitted ways : 379396

Now on to some routing!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.