Skip to content

Instantly share code, notes, and snippets.

@gopperman
Created October 27, 2017 15:13
Show Gist options
  • Select an option

  • Save gopperman/18cb66078372d3261420829630230b80 to your computer and use it in GitHub Desktop.

Select an option

Save gopperman/18cb66078372d3261420829630230b80 to your computer and use it in GitHub Desktop.
Install postgis-2.3.2 with postgres@9.6
brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/aa049a47b218fda30f9a4a454119ae067a02cf50/Formula/postgis.rb
#pg_config --pkglibdir is useful for finding your $libdir
cp -a /usr/local/share/postgresql/extension/postgis* /usr/local/Cellar/postgresql@9.6/9.6.5/share/postgresql@9.6/extension/
cp -a /usr/local/lib/postgresql/postgis-2.3.so /usr/local/Cellar/postgresql@9.6/9.6.5/lib/postgis-2.3
cp -a /usr/local/lib/postgresql/rtpostgis-2.3.so /usr/local/Cellar/postgresql@9.6/9.6.5/lib/
@nheeren

nheeren commented Nov 12, 2017

Copy link
Copy Markdown

Ok. I tried it, but had a number of issues. first of all I needed to use ln -s instead of cp-a.

@Peekmo

Peekmo commented Mar 21, 2018

Copy link
Copy Markdown

Perfect thank you ! I had also an error not found /usr/local/opt/proj/lib/libproj.12.dylib, but I had /usr/local/opt/proj/lib/libproj.13.dylib. So i did ln -sf /usr/local/lib/libproj.13.dylib /usr/local/lib/libproj.12.dylib which is probably not a good thing to do, but it worked ^^

@planemad

planemad commented May 17, 2018

Copy link
Copy Markdown

Updated commands for postgis 2.3 with postgres@9.6 9.6.9:

brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/aa049a47b218fda30f9a4a454119ae067a02cf50/Formula/postgis.rb

#pg_config --pkglibdir is useful for finding your $libdir
ln -s /usr/local/share/postgresql/extension/postgis* /usr/local/Cellar/postgresql@9.6/9.6.9/share/postgresql@9.6/extension
ln -s /usr/local/lib/postgresql/postgis-2.3.so /usr/local/Cellar/postgresql@9.6/9.6.9/lib/postgis-2.3
ln -s /usr/local/lib/postgresql/rtpostgis-2.3.so /usr/local/Cellar/postgresql@9.6/9.6.9/lib/

# Fixes issues with missing 
brew reinstall gdal2

@indapublic

Copy link
Copy Markdown

After execute brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/aa049a47b218fda30f9a4a454119ae067a02cf50/Formula/postgis.rb

I'm receiving Postgresql 10.4 installed as dependency

Warning: postgis 2.4.4_1 is available and more recent than version 2.3.2.
==> Installing dependencies for postgis: postgresql
==> Installing postgis dependency: postgresql
==> Downloading https://homebrew.bintray.com/bottles/postgresql-10.4.high_sierra.bottle.tar.gz

@indapublic

Copy link
Copy Markdown

I cannot create extension because:

hrm=# CREATE EXTENSION postgis;
ERROR:  could not load library "/usr/local/Cellar/postgresql@9.6/9.6.9/lib/postgis-2.3": dlopen(/usr/local/Cellar/postgresql@9.6/9.6.9/lib/postgis-2.3, 10): Library not loaded: /usr/local/opt/proj/lib/libproj.12.dylib
  Referenced from: /usr/local/Cellar/postgresql@9.6/9.6.9/lib/postgis-2.3
  Reason: image not found

gdal2 not found in brew

brew reinstall gdal2
Error: No available formula with the name "gdal2"

Tried to reinstall gdal, but it not solved problem of extension creation

@khommel

khommel commented Dec 30, 2018

Copy link
Copy Markdown

Trying to install PostGIS to work with existing Postgres 9.6. The above installed PostgreSQL 11.1, and failed to install PostGIS. Got this:

==> Pouring postgis-2.3.2.high_sierra.bottle.tar.gz
Error: undefined method `undent' for #<String:0x00007f80feb5d228>
Please report this bug:
  https://docs.brew.sh/Troubleshooting
/Users/khommel/Library/Caches/Homebrew/Formula/postgis.rb:132:in `caveats'
/usr/local/Homebrew/Library/Homebrew/caveats.rb:17:in `caveats'
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/forwardable.rb:202:in `empty?'
/usr/local/Homebrew/Library/Homebrew/formula_installer.rb:613:in `caveats'
/usr/local/Homebrew/Library/Homebrew/formula_installer.rb:664:in `finish'
/usr/local/Homebrew/Library/Homebrew/cmd/install.rb:330:in `install_formula'
/usr/local/Homebrew/Library/Homebrew/cmd/install.rb:259:in `block in install'
/usr/local/Homebrew/Library/Homebrew/cmd/install.rb:257:in `each'
/usr/local/Homebrew/Library/Homebrew/cmd/install.rb:257:in `install'
/usr/local/Homebrew/Library/Homebrew/brew.rb:89:in `<main>'

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