March 20, 2024

Django: Fuss-free use of Homebrew GDAL/GEOS libraries on macOS

GeoDjango requires the GDAL and GEOS spatial libraries. On macOS, you can use Homebrew to install these, but they won’t be picked up by default since they live in a non-default library directory, /opt/homebrew/lib. Django will fail to start with an exception:

Traceback (most recent call last …