I'm trying to install the spatialite on macOS to query a sqlite db with geocordinates.
There is a brew formula that ships that lib and tools
brew install libspatialite
brew install spatialite-tools
I installed those but when I try to load the library I get this error:
spatialite test.db 'SELECT load_extension("mod_spatialite")'
SpatiaLite version ..: 4.3.0a Supported Extensions:
- 'VirtualShape' [direct Shapefile access]
- 'VirtualDbf' [direct DBF access]
- 'VirtualXL' [direct XLS access]
- 'VirtualText' [direct CSV/TXT access]
- 'VirtualNetwork' [Dijkstra shortest path]
- 'RTree' [Spatial Index - R*Tree]
- 'MbrCache' [Spatial Index - MBR cache]
- 'VirtualSpatialIndex' [R*Tree metahandler]
- 'VirtualElementary' [ElemGeoms metahandler]
- 'VirtualXPath' [XML Path Language - XPath]
- 'VirtualFDO' [FDO-OGR interoperability]
- 'VirtualGPKG' [OGC GeoPackage interoperability]
- 'VirtualBBox' [BoundingBox tables]
- 'SpatiaLite' [Spatial SQL - OGC]
PROJ.4 version ......: Rel. 4.9.3, 15 August 2016
GEOS version ........: 3.6.2-CAPI-1.10.2 4d2925d6
LWGEOM version ......: 2.1.5
TARGET CPU ..........: x86_64-apple-darwin17.0.0
Error: dlopen(mod_spatialite, 10): image not found
I did have this installed on my previous mac and it was working just fine.
brew doctor
looks ok as well:
brew doctor
Your system is ready to brew.
And the dynamic library is present:
brew list libspatialite
/usr/local/Cellar/libspatialite/4.3.0a_3/include/spatialite/ (19 files)
/usr/local/Cellar/libspatialite/4.3.0a_3/include/spatialite.h
/usr/local/Cellar/libspatialite/4.3.0a_3/lib/libspatialite.7.dylib
/usr/local/Cellar/libspatialite/4.3.0a_3/lib/mod_spatialite.7.dylib
/usr/local/Cellar/libspatialite/4.3.0a_3/lib/pkgconfig/spatialite.pc
/usr/local/Cellar/libspatialite/4.3.0a_3/lib/ (3 other files)
Try to specify a full filename for the module in SQL:
SELECT load_extension("mod_spatialite.dylib")
or
SELECT load_extension("mod_spatialite.7.dylib")