# Install osm2pgsql with Homebrew, apt, dnf, MacPorts, Nix, pacman

OpenStreetMap data to PostgreSQL converter. Version 2.3.1 via Homebrew; verified 2026-07-05.

## Install

```sh
sudo av install brew:osm2pgsql
```

Additional install commands:

### macOS

- Homebrew (100%):

```sh
brew install osm2pgsql
```

  Evidence: local Homebrew formula metadata

- MacPorts (94%):

```sh
sudo port install osm2pgsql
```

  Evidence: MacPorts ports tree: gis/osm2pgsql/Portfile from https://api.github.com/repos/macports/macports-ports/git/trees/master?recursive=1

### Linux

- Debian apt (92%):

```sh
sudo apt install osm2pgsql
```

  Evidence: Debian stable package indexes: osm2pgsql from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz

- dnf (92%):

```sh
sudo dnf install osm2pgsql
```

  Evidence: Fedora Rawhide package metadata: osm2pgsql from https://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/repodata/e5ca8ce900cd68f5419e1c39ae517343100b306336cbaeb70a3c153121d95094-primary.xml.zst

- Nix (92%):

```sh
nix profile install nixpkgs#osm2pgsql
```

  Evidence: nixpkgs package indexes: pkgs/by-name/os/osm2pgsql/package.nix from https://api.github.com/repos/NixOS/nixpkgs/git/trees/master?recursive=1

- pacman (92%):

```sh
sudo pacman -S osm2pgsql
```

  Evidence: Arch Linux sync databases: osm2pgsql from https://geo.mirror.pkgbuild.com/extra/os/x86_64/extra.db.tar.gz

## Package facts

- **Package key:** brew:osm2pgsql
- **Package manager:** Homebrew
- **Package manager page:** <https://formulae.brew.sh/formula/osm2pgsql>
- **Version:** 2.3.1
- **Source summary:** OpenStreetMap data to PostgreSQL converter
- **Homepage:** <https://osm2pgsql.org>
- **Repository:** <https://github.com/osm2pgsql-dev/osm2pgsql>
- **Upstream docs:** <https://osm2pgsql.org/doc>
- **License:** GPL-2.0-or-later
- **Source archive:** <https://github.com/osm2pgsql-dev/osm2pgsql/archive/refs/tags/2.3.1.tar.gz>
- **Last updated:** 2026-07-05T16:19:51Z
- **Generated:** 2026-07-08T18:08:21+00:00

## Executables

- osm2pgsql (cli)
- osm2pgsql-replication (cli)
- osm2pgsql (alias)
- osm2pgsql-replication (alias)

## Dependencies

- libpq
- luajit
- proj

## Build dependencies

- boost
- cli11
- cmake
- fmt
- libosmium
- lua
- nlohmann-json
- protozero

## Uses from macOS

- bzip2
- expat

## Install behavior

- Post-install hook: not defined
- Bottle: available on arm64_linux, arm64_sequoia, arm64_sonoma, arm64_tahoe, sonoma, x86_64_linux

## Freshness

- Page generated: 2026-07-08
- Package-manager version: 2.3.1
- Package-manager updated: 2026-07-05
- Local data: ok
- Upstream repository: https://github.com/osm2pgsql-dev/osm2pgsql
- Upstream latest detected: 2.3.1 (current)
## Project history and usage

osm2pgsql is one of the central OpenStreetMap data-ingestion tools. It imports OSM data into PostgreSQL/PostGIS, where renderers, geocoders, analysis jobs, and custom SQL pipelines can work with planet-scale map data.

### Project history

The osm2pgsql project began in 2006, started by Jon Burgess and written in C, making it nearly as old as OpenStreetMap itself. In 2007, after OSM moved to API 0.5 and added relations, osm2pgsql gained multipolygon relation support and multiple projection support.

In 2008, osm2pgsql added support for OSM change files. From 2009, the main OpenStreetMap map was regenerated from minutely changes using a toolchain that imported data with osm2pgsql into PostgreSQL/PostGIS and rendered tiles with Mapnik.

The project kept following OSM's growth. In 2011, it switched to 64-bit IDs as the OSM node count passed one billion, and Kai Krueger took over maintainership from Jon Burgess. In 2012, the flat-file persistent node cache for slim mode reduced disk usage and improved import/update performance.

A long modernization arc followed: parsing moved to libosmium in 2015, geometry generation moved to libosmium in 2017, LuaJIT support arrived in 2018, version 1.0 in 2019 removed old-style multipolygon processing, and the flex output introduced in 2020 made custom output-table design a first-class workflow.

The 2022 experimental `osm2pgsql-gen` command brought generalization into the project. In 2023, a JSONB-based middle database format made it possible to store all OSM data including tags, attributes, and relation-member information. In 2024, Nominatim switched to flex output, the old gazetteer output was removed, and osm2pgsql 2.0 shipped.

### Adoption history

osm2pgsql became deeply embedded because it solved the hard practical problem of keeping PostgreSQL/PostGIS databases synchronized with OSM data at rendering scale. The project history explicitly ties it to the OpenStreetMap tile toolchain and to Nominatim, the geocoder powering search on openstreetmap.org and many other map sites.

The GitHub repository passed 1,000 stars in 2021 according to the project's own history page. The Homebrew formula and package-manager metadata show distribution through Homebrew, Debian, Fedora, MacPorts, Nix, Arch, Ubuntu, and openSUSE-family packaging.

### How it is used

The manual describes osm2pgsql as a specialized ETL tool for OSM data. Users usually feed it regional extracts or planet files, tune memory and disk behavior, choose pgsql or flex output, and then connect downstream software for rendering, serving, geocoding, or analysis.

The manual also warns that whole-planet imports can run for hours or days and recommends trial runs on small extracts. That operational reality is part of osm2pgsql's identity: it is not just a converter, but a tool whose schema, cache, update, and style choices determine the shape and cost of an OSM database.

### Why package nerds care

osm2pgsql is package-nerd gold because it sits at the junction of C++, libosmium, Lua/LuaJIT, PostgreSQL, PostGIS, and large public datasets. Small version changes can affect import speed, schema output, multipolygon behavior, replication workflows, and downstream projects such as Nominatim or map renderers.

Its history also mirrors the OpenStreetMap ecosystem's scaling story: from early XML imports, through minutely updates and 64-bit IDs, into flexible Lua-defined outputs and JSONB-backed middle storage.

### Timeline

- 2006: Jon Burgess starts osm2pgsql in C.
- 2007: relation, multipolygon, and projection support expand after OSM API 0.5.
- 2008-2009: change-file support enables minutely-update rendering workflows.
- 2009: Nominatim begins using osm2pgsql with special gazetteer output.
- 2011: 64-bit IDs land, and Kai Krueger becomes maintainer.
- 2012: the flat-file persistent node cache improves slim-mode import and update performance.
- 2015-2017: libosmium takes over parsing and geometry generation.
- 2019-2020: version 1.0 and flex output modernize the processing pipeline.
- 2022-2024: generalization, JSONB middle storage, Nominatim's flex-output migration, and osm2pgsql 2.0 reshape the project.

### Related projects

- PostgreSQL and PostGIS are the target database stack. Mapnik is historically tied to the OSM tile-rendering toolchain. Nominatim uses osm2pgsql-derived import paths for geocoding data. libosmium underpins OSM parsing and geometry handling in modern osm2pgsql.

### Sources

- <https://api.github.com/repos/osm2pgsql-dev/osm2pgsql>
- <https://formulae.brew.sh/formula/osm2pgsql>
- <https://osm2pgsql.org/about/>
- <https://osm2pgsql.org/about/history/>
- <https://osm2pgsql.org/doc/manual.html>


## Security Notes

broad file, network, media, or database tool signal. generalized runtime or code generation signal.

- **Geiger risk:** yellow / medium
- broad file, network, media, or database tool signal
- generalized runtime or code generation signal

## Source Database Details

- **Source Database:** Homebrew formula API
- **Tap:** homebrew/core
- **Full Name:** osm2pgsql
- **Version Scheme:** 0
- **Revision:** 0
- **Head Version:** HEAD
- **Bottle Stable Root URL:** <https://ghcr.io/v2/homebrew/core>
- **Deprecated:** no
- **Disabled:** no
- **Keg Only:** no
- **URL Keys:** head, stable

## Other Package-Manager Records

- Debian apt - osm2pgsql - 2.1.1+ds-1: normalized package name match | Debian stable package indexes: osm2pgsql from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | OpenStreetMap data to PostgreSQL converter | https://osm2pgsql.org/
- Nix - osm2pgsql: normalized package name match | nixpkgs package indexes: pkgs/by-name/os/osm2pgsql/package.nix from https://api.github.com/repos/NixOS/nixpkgs/git/trees/master?recursive=1
- Ubuntu apt - osm2pgsql - 1.11.0+ds-1: normalized package name match | Ubuntu 24.04 LTS package indexes: osm2pgsql from https://archive.ubuntu.com/ubuntu/dists/noble/universe/binary-amd64/Packages.gz | OpenStreetMap data to PostgreSQL converter | https://osm2pgsql.org/
- dnf - osm2pgsql - 2.2.0-4.fc45: normalized package name match | Fedora Rawhide package metadata: osm2pgsql from https://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/repodata/e5ca8ce900cd68f5419e1c39ae517343100b306336cbaeb70a3c153121d95094-primary.xml.zst | Import map data from OpenStreetMap to a PostgreSQL database | https://osm2pgsql.org/
- pacman - osm2pgsql - 2.2.0-2: normalized package name match | Arch Linux sync databases: osm2pgsql from https://geo.mirror.pkgbuild.com/extra/os/x86_64/extra.db.tar.gz | tool for loading OpenStreetMap data into a PostgreSQL / PostGIS database | https://osm2pgsql.org/
- MacPorts - osm2pgsql: normalized package name match | MacPorts ports tree: gis/osm2pgsql/Portfile from https://api.github.com/repos/macports/macports-ports/git/trees/master?recursive=1


## Related links

- [Secret-risk packages](https://www.automicvault.com/pkg/secret-risk-packages/) - Has protected-tool coverage, approval-gate, or non-low Geiger security signals.
- [Terminal utility packages](https://www.automicvault.com/pkg/terminal-utilities/) - Matched terminal and command-line workflow metadata.
- [Text processing packages](https://www.automicvault.com/pkg/text-processing-tools/) - Matched text, document, or structured-data processing metadata.
- [Networking and protocol packages](https://www.automicvault.com/pkg/networking-protocol-tools/) - Matched network, protocol, or remote-service metadata.
- [libpq](https://www.automicvault.com/pkg/brew/libpq/) - Runtime dependency declared by Homebrew.
- [luajit](https://www.automicvault.com/pkg/brew/luajit/) - Runtime dependency declared by Homebrew.
- [proj](https://www.automicvault.com/pkg/brew/proj/) - Runtime dependency declared by Homebrew.
- [cmake](https://www.automicvault.com/pkg/brew/cmake/) - Build dependency declared by Homebrew.
- [osm2pgrouting](https://www.automicvault.com/pkg/brew/osm2pgrouting/) - Shares av.db curated category or tags: cli, data, geospatial, importer, openstreetmap.
- [imposm3](https://www.automicvault.com/pkg/brew/imposm3/) - Shares av.db curated category or tags: cli, data, geospatial, openstreetmap, postgis.
- [martin](https://www.automicvault.com/pkg/brew/martin/) - Shares av.db curated category or tags: cli, data, geospatial, postgis.
- [osm-pbf](https://www.automicvault.com/pkg/brew/osm-pbf/) - Shares av.db curated category or tags: cli, data, geospatial, openstreetmap.
- [osmcoastline](https://www.automicvault.com/pkg/brew/osmcoastline/) - Shares av.db curated category or tags: cli, data, geospatial, openstreetmap.
- [osmfilter](https://www.automicvault.com/pkg/brew/osmfilter/) - Shares av.db curated category or tags: cli, data, geospatial, openstreetmap.
- [osmium-tool](https://www.automicvault.com/pkg/brew/osmium-tool/) - Shares av.db curated category or tags: cli, data, geospatial, openstreetmap.
- [osmosis](https://www.automicvault.com/pkg/brew/osmosis/) - Shares av.db curated category or tags: cli, data, geospatial, openstreetmap.
- [mapnik](https://www.automicvault.com/pkg/brew/mapnik/) - Local package facts share a topical domain. Shared terms: cli, data, geospatial, libpq, proj.

## Combined YAML source

View the package source record on GitHub. [combined/osm2pgsql.yml](https://github.com/automic-vault/db/blob/main/combined/osm2pgsql.yml)


## Sources

- Nucleus package database
- Geiger risk classifier
- package-page enrichment
- curated package history
- package version freshness
- av.db category and tag curation
- package relationship graph
- external package-manager database matches
- cross-ecosystem install command graph
