thynson / homebrew-tap

Homebrew formulas for Postgres 9.6 and Postgis 2.4

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

homebrew-tap

This is a Homebrew Tap forked from Clover Health's one, to provide a postgis formula for postgres@11.

Installing Postgres@11 and Postgis 2.5

First ensure you have upgraded to the latest homebrew:

brew update

It's recommended to go ahead and clear any existing Postgres and Postgis installations:

brew uninstall postgis --force
brew uninstall postgresql --force
brew cleanup
brew services stop postgresql

After this, install Clover's custom brew tap:

brew tap thynson/homebrew-tap

Then install the latest version of Postgres and unlink it. This is done first so that we can explicitly switch to an earlier version before installing Postgis:

brew install postgresql
brew unlink postgresql

The previous install of postgresql runs initdb, which creates database structures incompatible with 9.6.10. This needs to be removed with:

rm -rf /usr/local/var/postgres

Postgis 2.5 can be installed with:

brew install postgis@2.5_postgres11

Try running and accessing Postgres with the following:

brew services start postgresql@11
psql postgres

After running psql postgres, type the following in the prompt to verify your Postgis installation:

drop extension postgis;  -- This might fail if it wasn't previously installed
create extension postgis;  -- This should pass
select ST_Distance(
  ST_GeometryFromText('POINT(-118.4079 33.9434)', 4326), -- Los Angeles (LAX)
  ST_GeometryFromText('POINT(2.5559 49.0083)', 4326)     -- Paris (CDG)
);  -- This should print a row with 121.898285970107 as a value

About

Homebrew formulas for Postgres 9.6 and Postgis 2.4


Languages

Language:Ruby 100.0%