Skip to content

Instantly share code, notes, and snippets.

@ian29
Last active December 21, 2015 22:49
Show Gist options
  • Save ian29/6378206 to your computer and use it in GitHub Desktop.
Save ian29/6378206 to your computer and use it in GitHub Desktop.
easiest way to install postgres (and postgis) on mac os x
# !/bin/bash
# make sure homebrew is up-to-date and install some stuff
brew update
brew install postgres || brew upgrade postgres
brew install postgis || brew upgrade postgis
# if you dont have brew on your path yet
echo "export PATH=/usr/local/bin:$PATH" >> ~/.bash_profile
source ~/.bash_profile
# start postgres
initdb /usr/local/var/postgres -E utf8
pg_ctl -D /usr/local/var/postgres -l ~/.pg_log start
@ian29
Copy link
Author

ian29 commented Aug 29, 2013

brew info postgres will set you free

@ian29
Copy link
Author

ian29 commented Jan 17, 2014

CAVEAT

when i run

psql test -c "create extension postgis"

i receive the following error:

ERROR: could not load library "/usr/local/Cellar/postgresql/9.2.4/lib/postgis-2.1.so": dlopen(/usr/local/Cellar/postgresql/9.2.4/lib/postgis-2.1.so, 10): Library not loaded: /usr/local/lib/libgeos_c.1.8.0.dylib
Referenced from: /usr/local/Cellar/postgresql/9.2.4/lib/postgis-2.1.so
Reason: image not found

for some reason postgis.2.1.0 is referencing /usr/local/lib/libgeos_c.1.8.0.dylib, but brew installs v3.4.x. as a workaround i just did

ln -s /usr/local/lib/libgeos_c.dylib /usr/local/lib/libgeos_c.1.8.0.dylib

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