title: GeoDjango setup: ERROR: could not access file "$libdir/postgis-1.5": No such file or directory
body: <p>Update: thought I'd solved it, but I hadn't... please see below.</p>
  
  <hr>
  
  <p>I'm installing GeoDjango on Mac OSX. I've followed the <a href="http://docs.djangoproject.com/en/dev/ref/contrib/gis/install/#mac-os-x" rel="noreferrer">Mac install instructions</a>, which all went smoothly, and am now <a href="http://docs.djangoproject.com/en/dev/ref/contrib/gis/install/#creating-a-spatial-database-template-for-postgis" rel="noreferrer">creating a spatial database template for PostGIS</a>.</p>
  
  <p>However, when I try to load the PostGIS SQL routines, I get <code>ERROR:  could not access file "$libdir/postgis-1.5": No such file or directory</code>: </p>
  
  <pre><code>postgres$ psql -d template_postgis -f $POSTGIS_SQL_PATH/postgis.sql
  psql:/usr/local/pgsql/share/contrib/postgis-1.5/postgis.sql:59: ERROR:  could not access file "$libdir/postgis-1.5": No such file or directory
  &lt;snip&gt;
  psql:/usr/local/pgsql/share/contrib/postgis-1.5/postgis.sql:7785: ERROR:  type "geometry" does not exist
  </code></pre>
  
  <p>What's going wrong, and how can I fix it?</p>
  
  <p>I found <a href="http://logs.qgis.org/postgis/%23postgis.2010-03-12.log" rel="noreferrer">these instructions from postgis IRC</a>, but I think I'm running the right version of pg_config, etc:</p>
  
  <pre><code>postgres$ which pg_config
  /usr/local/pgsql/bin//pg_config
  postgres$ which psql
  /usr/local/pgsql/bin//psql
  postgres$ pg_config --pkglibdir
  /usr/local/pgsql/lib
  </code></pre>
  
  <p>I installed postgres and its PostGIS extensions from <a href="http://www.kyngchaos.com/software/postgres" rel="noreferrer">KyngChaos</a>. If I look in <code>/usr/local/pgsql/lib</code>, there is a file called <code>postgis-1.5.so</code> there, so I don't understand why it's not being found.</p>