Skip to content

Instantly share code, notes, and snippets.

@jsugarman
Created March 14, 2024 12:06
Show Gist options
  • Save jsugarman/87092900735b34f4b368074e62a86dc3 to your computer and use it in GitHub Desktop.
Save jsugarman/87092900735b34f4b368074e62a86dc3 to your computer and use it in GitHub Desktop.
install postgis on mac (M1 chip) OSX (sonoma) with postgresql@16
[brew uninstall postgresql@14]
# check version specific path
[brew install postgresql@16]
sudo ln -sf /opt/homebrew/Cellar/postgresql@16/16.2_1/bin/postgres /usr/local/bin/postgres
brew install postgis
# utilities if you need them installed
brew install wget
brew install pcre
# if you get errors not finding `libintl.h`
brew reinstall gettext
brew unlink gettext && brew link gettext --force
# make postgis
wget https://download.osgeo.org/postgis/source/postgis-3.4.0.tar.gz
tar -xvzf postgis-3.4.0.tar.gz
rm postgis-3.4.0.tar.gz
cd cd postgis-3.4.0
# check gettext version specific path
./configure --with-projdir=/opt/homebrew/opt/proj --with-protobufdir=/opt/homebrew/opt/protobuf-c --with-pgconfig=/opt/homebrew/opt/postgresql@16/bin/pg_config --with-jsondir=/opt/homebrew/include/json-c --with-sfcgal=/opt/homebrew/opt/sfcgal/bin/sfcgal-config --with-pcredir=/opt/homebrew/opt/pcre "LDFLAGS=$LDFLAGS -L/opt/homebrew/Cellar/gettext/0.22.5/lib" "CFLAGS=-I/opt/homebrew/Cellar/gettext/0.22.5/include"
# build/make
[sudo] [NO_GETTEXT=1] make
[sudo] [NO_GETTEXT=1] make install
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment