Compiling from Source

PostGIS has many packaged installations, but if you are more adventurous and want to compile your own, refer to our source download and compilation instructions:

Binary Installers

Binary distributions of PostGIS are available for various operating systems.


PostGIS has a community docker-postgis project. Production ready PostGIS Docker builds can be pulled from PostGIS docker hub


  • More details about getting up and running with windows can be found on Windows Downloads page.

Red Hat / Centos / Scientific Linux

Ubuntu / Debian


  • A popular distribution particularly for newbies is It includes generally latest version of PostgreSQL, PostGIS, and PLV8. Great for development and testing. Do not mix with other installations.

  • Homebrew users can just run "brew install postgis" and tends to be a favorite for more advanced users since there are brew scripts for most of the popular PostgreSQL extensions, not always present in other Mac distributions.

  • The EnterpriseDb OSX PostgreSQL combination from EnterpriseDB includes generally latest stable minor version of PostGIS.

  • The builds from KyngChaos are a little dated but useful for older PostGIS versions. Read the instructions carefully. Do not mix with other installations.


Distributions targeting more than one OS (these include PostgreSQL and many other PostgreSQL extensions)

  • EnterpriseDb PostgreSQL - Supports 32-bit/64-bit Linux, MacOSX, Windows Note that the MacOSX PostGIS package and EDB Windows PostGIS package have different maintainers, so offerings are not equivalent. Both versions generally have latest minor version of PostGIS, but versions of libraries used may be different, other PostGIS related extensions like pgRouting, postgis_sfcgal are packaged with the windows but not OSX version.

Additional Install Guides

Getting Started

In order to use PostGIS you first need to install the binaries. You can install these via package managers or compile PostGIS yourself.

Enabling PostGIS

PostGIS is an optional extension that must be enabled in each database you want to use it in before you can use it. Installing the software is just the first step. DO NOT INSTALL it in the database called postgres.

Connect to your database with psql or PgAdmin. Run the following SQL. You need only install the features you want:

 1-- Enable PostGIS (as of 3.0 contains just geometry/geography)
 3-- enable raster support (for 3+)
 4CREATE EXTENSION postgis_raster;
 5-- Enable Topology
 6CREATE EXTENSION postgis_topology;
 7-- Enable PostGIS Advanced 3D
 8-- and other geoprocessing algorithms
 9-- sfcgal not available with all distributions
10CREATE EXTENSION postgis_sfcgal;
11-- fuzzy matching needed for Tiger
12CREATE EXTENSION fuzzystrmatch;
13-- rule based standardizer
14CREATE EXTENSION address_standardizer;
15-- example rule data set
16CREATE EXTENSION address_standardizer_data_us;
17-- Enable US Tiger Geocoder
18CREATE EXTENSION postgis_tiger_geocoder;

Upgrading PostGIS

To upgrade PostGIS, you first have to install the latest binaries and then upgrade each database you have PostGIS installed in.

For example connect to database you want to upgrade and if you just installed binaries for 2.5. You can upgrade from 2.5 to 3.1, 3.3 etc using this approach. To go from 1.* to 2.* or 1.* to 3.* you need to do a hard upgrade. Refer to PostGIS install for more extensive instructions. Note: that as of PostGIS 2.1.3 and PostGIS 2.0.6, you need to set environment variables or GUCS to get full features.

For PostGIS 3+

1-- Upgrades postgis and other installed postgis packaged extensions
2SELECT postgis_extensions_upgrade();

For PostGIS 2.5 and below

1-- Upgrade PostGIS and postgis packaged extensions
3SELECT postgis_extensions_upgrade();
4SELECT postgis_extensions_upgrade();

or to a specific version

1-- Upgrade PostGIS (repeat for each PostGIS packaged extension you have installed)
3 UPDATE TO "3.3.1";

Spatial SQL

See the documentation for more guidance.

 1-- Create table with spatial column
 2CREATE TABLE mytable (
 4  geom GEOMETRY(Point, 26910),
 5  name VARCHAR(128)
 8-- Add a spatial index
 9CREATE INDEX mytable_gix
10  ON mytable
11  USING GIST (geom);
13-- Add a point
14INSERT INTO mytable (geom) VALUES (
15  ST_GeomFromText('POINT(0 0)', 26910)
18-- Query for nearby points
19SELECT id, name
20FROM mytable
21WHERE ST_DWithin(
22  geom,
23  ST_GeomFromText('POINT(0 0)', 26910),
24  1000