Skip to content

Instantly share code, notes, and snippets.

@srt32
Last active July 18, 2021 23:43
Show Gist options
  • Save srt32/11265183 to your computer and use it in GitHub Desktop.
Save srt32/11265183 to your computer and use it in GitHub Desktop.
installing PostGIS on OSX

Installing the Postgres PostGIS extension on OSX

For reference: http://postgis.net/install

If you don’t already have PG installed

The most reliable way to get PostGIS on OSX is to download and install Postgres.app. Great for development and testing. Do not mix with other installations. Select the extension when prompted.

If you already have PG installed

You just need to add the extensions, Homebrew users can just run brew install postgis

  • Drop into your database

    psql oneblock_development

  • Run the following commands to add the extensions.

-- Enable PostGIS (includes raster)

$ CREATE EXTENSION postgis;

If you get:

ERROR:  58P01: could not open extension control file "/usr/local/Cellar/postgresql/9.3.4/share/postgresql/extension/postgis.control": No such file or directory

you probably don’t have the extension installed correctly.

-- Enable Topology

$ CREATE EXTENSION postgis_topology;

-- fuzzy matching needed for Tiger

$ CREATE EXTENSION fuzzystrmatch;

-- Enable US Tiger Geocoder

$ CREATE EXTENSION postgis_tiger_geocoder;

Confirm that it worked:

$ SELECT POSTGIS_FULL_VERSION();

You should see a message including postgis_full_version followed by a version number and some other info.

@delongGao
Copy link

thanks @jordanmkoncz, this is the issue for my case as well. For others who may run into this in the future: if you are not sure whether your postgresql and postgis versions are compatible, don't directly do brew install postgis, this will always install the latest postgis with all the latest dependencies(can be checked here). It can cause you trouble later if you need to downgrade with all the dependencies installed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment