While browsing through a Postgres-Rails app in development, I came across a page error-ing out due to a PG error. Thinking my current Git branch's schema may have been out of sync with my database, I attempted to rake db:reset
. This caused an error (that I'm no longer able to reproduce) claiming it couldn't find the postgis.control
file (IIRC) in usr/local/Cellar/postgresql/9.3.5/share/postgresql
directory. After seeing that that control file existed in the corresponding directory for my 9.3.4 version of Postgres, I attempted many things, but eventually uninstalled my postgres-9.3.4 and brew uninstalled and then installed again PostGIS. At some point, though my every attempt to reset the database continued to fail, the error message changed to
ERROR: could not load library "/usr/local/Cellar/postgresql/9.3.5/lib/rtpostgis-2.1.so": dlopen(/usr/local/Cellar/postgresql/9.3.5/lib/rtpostgis-2.1.so, 10): Library not loaded: /usr/local/lib/libspatialite.5.dylib
I then attempted to uninstall Postgres and reinstall, but even this didn't solve the problem.
(Note: I have tried to create the extension to PostGIS in the Postgres console, but this has given the exact same error as what's listed above).
Alright figured it out!
So I'm not sure this was even something directly related to Postgres or PostGis.
In my initial post, I omitted the subsequent error lines which actually ended up being essential. They were
Referenced from: /usr/local/lib/libgdal.1.dylib
Reason: image not found
libgdal.1.dylib is a file from GDAL (Geospatial Data Abstraction Library). The missing file, libspatialite.5.dylib, is from SpatiaLite, a library for expanding SQLite. In /usr/local/lib/ I had another file, libspatialite.7.dylib, but no libspatialite.5.lib. After poking around in /usr/local/opt and other subdirectories around there, I found out that I had two versions of SpatiaLite, the earlier one using libspatialite.5.dylib, the later using libspatialite.7.lib.
It seemed my GDAL had gotten out of sync with my latest versions of spatialite. I executed
$ brew uninstall gdal
$ brew install gdal
and my problem was solved!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With