Installing PostGIS with Homebrew

The PostGIS web site doesn’t currently provide instructions for installing PostGIS with Homebrew, so I wrote down the required steps.

To install the current version, run

brew install postgis

Afterwards, follow the instructions on to enable the extension in Postgres.

It’s also possible to install an older version. Run

brew search postgis

It will output something like this:

brew/versions/postgis15   brew/versions/postgis20

This tells us that in addition to the current version, Homebrew has PostGIS 1.5 and 2.0 available in the Versions repository. First, you need to enable it with

brew tap homebrew/versions

Then, you can install PostGIS 2.0, for example:

brew install postgis20

Note that an older version may depend on an older version of PostgreSQL, so it may install it alongside the version you have. For example, postgis20 depends on Postgres 9.2.

Comments or questions? I’m @alexkorban on Twitter.

Is the time dimension of your data giving you headaches?

“PostgreSQL: Time and Temporal Data” is a short book that will help you get it under control. Master Postgres time tools, get a handle on time zones, learn how to represent and query complex temporal data.

Pop in your email to receive a sample chapter.

You will also get notifications of new posts along with other mailing list only freebies.

Book cover