PG::InternalError: ERROR: incompatible library "/usr/local/lib/postgresql/postgis-2.4.so": version mismatch
DETAIL: Server is version 9.6, library is version 10.0.
: CREATE EXTENSION IF NOT EXISTS "postgis"
/Users/bruce/Projects/HB-Backend/db/migrate/20151013213623_enable_postgis.rb:3:in `change'
-e:1:in `<main>'
Caused by:
ActiveRecord::StatementInvalid: PG::InternalError: ERROR: incompatible library "/usr/local/lib/postgresql/postgis-2.4.so": version mismatch
DETAIL: Server is version 9.6, library is version 10.0.
: CREATE EXTENSION IF NOT EXISTS "postgis"
brew info postgresql
brew info postgis
psql --version
which psql
- restart with homebrew
brew services restart postgresql
- restart with pg_ctl
pg_ctl -D /usr/local/var/postgres stop pg_ctl -D /usr/local/var/postgres start
- restart your Mac
ref: https://stackoverflow.com/questions/7975556/how-to-start-postgresql-server-on-mac-os-x
brew info postgis
# if found old versions:
brew switch postgis 2.4.4_1
brew reinstall postgis
ref: Homebrew/legacy-homebrew#46358
brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/aa049a47b218fda30f9a4a454119ae067a02cf50/Formula/postgis.rb
after this, the error message changed but I didn't record it down.
ref:
- https://stackoverflow.com/questions/3987683/homebrew-install-specific-version-of-formula/17757092#17757092
- https://gist.github.com/srt32/11265183
download source from https://postgis.net/install/
in my case, it's postgis-2.4.4.tar.gz
# change path accordingly
brew unlink postgis
tar zxf postgis-2.4.4.tar.gz
cd postgis-2.4.4
./configure --with-pgconfig=/usr/local/Cellar/postgresql/9.6.2/bin/pg_config --with-xml2config=/usr/local/Cellar/libxml2/2.9.7/bin/xml2-config
make
make install
ref: