Skip to main content

Installation

Osm2pgsql works on Linux, Windows, macOS, and other systems. We recommend you always use the latest released version, currently 1.4.0.

Packaging status latest packaged version(s)

Installing on Linux

There are packages of osm2pgsql available for many different Linux distributions. Some of them are quite old, though, and have known bugs. If the current release is not available for your distribution, consider installing the current release from source.

Installing on Ubuntu

Ubuntu 18.04 package Ubuntu 20.04 package Ubuntu 20.10 package

For Ubuntu installation is usually as simple as

apt install osm2pgsql

Installing on Debian

Debian Stable package Debian Stable Backports package Debian Testing package

For Debian installation is usually as simple as

apt install osm2pgsql

If you are using Debian Stable, we recommend using the packages from backports. Debian maintainers are really good at keeping these up-to-date.

Installing on Fedora

Fedora 33 package Fedora Rawhide package

Fedora has packages of osm2pgsql available. Install with

dnf install osm2pgsql

Installing on openSUSE

First add the “Geo” package repository (adapt URL to the openSUSE version you use):

zypper ar https://download.opensuse.org/repositories/Application:/Geo/openSUSE_Leap_15.2/ "Geo"
zypper refresh

Then install osm2pgsql:

zypper install osm2pgsql

Installing on Arch Linux

AUR package

Build the osm2pgsql-git package from the AUR. (Download the tarball and compile/install with makepkg, or use an AUR helper such as yaourt.)

Installing from Source / Git

If you can’t use the packaged version of osm2pgsql for your distribution, you can always install from source.

See the Building section in the README.md for a list of dependencies and build instructions.

Installing on Windows

Using prebuild binaries

You can download prebuild binaries. Unpack the ZIP file and you can immediately use osm2pgsql.

Compiling from source

For native Windows compilation you need a C++11-compatible compiler. Visual Studio 2017 & 2015 are known to work. Follow the usual steps for compiling CMake projects.

Installing on macOS

Homebrew package

Osm2pgsql is available on Homebrew. Install with

brew install osm2pgsql

Installing on FreeBSD

FreeBSD port

Osm2pgsql is available in FreeBSD Ports. Install with:

pkg install converters/osm2pgsql

Upgrading an Existing Installation

Usually you can upgrade an existing installation of osm2pgsql to a new version without worries. But sometimes the database format or something like it changes and you have to re-import the OSM data, create a new index or so. Please read the release information carefully. There is also an appendix in the manual with upgrading information.