Osm2pgsql works on Linux, Windows, macOS, and other systems. We recommend you always use the latest released version, currently 1.4.1.
- Installing on Linux
- Installing on Windows
- Installing on macOS
- Installing on FreeBSD
- Upgrading an Existing Installation
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
For Ubuntu installation is usually as simple as
apt install osm2pgsql
Installing on Debian
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 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
package from the
(Download the tarball and compile/install with
makepkg, or use an AUR helper
Installing from Source / Git
If you can’t use the packaged version of osm2pgsql for your distribution, you can always install from source.
- To install the latest release, download the
zipfile and unpack it.
- To install a version from git, get it with
git clone https://github.com/openstreetmap/osm2pgsql.
See the Building section in the
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
Osm2pgsql is available on Homebrew. Install with
brew install osm2pgsql
Installing on FreeBSD
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.