Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I'm installing GeoDjango on Mac OSX. I've followed the official Mac install instructions, which all went smoothly, and am now creating a spatial database template for PostGIS.

However, when I try to load the PostGIS SQL routines, I get ERROR: could not access file "$libdir/postgis-1.5": No such file or directory:

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
<snip>
psql:/usr/local/pgsql/share/contrib/postgis-1.5/postgis.sql:7785: ERROR:  type "geometry" does not exist

What's going wrong, and how can I fix it?

I think I'm running the right version of pg_config, etc:

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

If I look in /usr/local/pgsql/lib, there is a file called postgis-1.5.so there, so I don't understand why it's not found.

-----UPDATE-------

Does this tell anyone anything?

delirium:~ ap257$ otool -L /usr/local/pgsql/lib/postgis-1.5.so
/usr/local/pgsql/lib/postgis-1.5.so:
        /Library/Frameworks/GEOS.framework/Versions/3/GEOS (compatibility version 4.0.0, current version 4.2.0)
        /Library/Frameworks/PROJ.framework/Versions/4/PROJ (compatibility version 7.0.0, current version 7.6.0)
        /usr/lib/libxml2.2.dylib (compatibility version 10.0.0, current version 10.3.0)
        /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.3)
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.0.0)
        /usr/lib/libicucore.A.dylib (compatibility version 1.0.0, current version 40.0.0)
share|improve this question
add comment

3 Answers

up vote 1 down vote accepted

Do you have another simultaneous installation of Postgres that might be conflicting?

What does ldd return?:

ldd /usr/local/pgsql/lib/postgis-1.5.so

Also, see this suggestion from another report of the issue.

share|improve this answer
    
Thanks! ldd (actually otool for Mac) returns as shown above. I suspect there is another leftover installation of postgres and that is the root of the problem - however I can't find another pg_config on my machine (using mdfind). –  AP257 Aug 3 '10 at 12:51
1  
I just tried installing on a OS X box, and it worked as expected. Could you try hardcoding the path in the first entry of postgis.sql to /usr/local/pgsql/lib to see if it has any effect? –  scw Aug 4 '10 at 0:16
    
Bizarrely, rebooting fixed the problem. Your suggestion sounds like a good one, though. Thanks! –  AP257 Aug 4 '10 at 13:39
    
FWIW, hardcoding the path as @scw suggests works for me –  yalestar Aug 3 '11 at 20:52
add comment

Basically the answer (I found) was to make sure you've completely, totally uninstalled any other versions of postgres on your Mac before you begin the GeoDjango installation. I fixed it eventually by nuking the other postgres, and starting again from scratch.

share|improve this answer
1  
+1 I was getting this same error. Turns out, I had a couple of other postgres installs. Blowing them all way and then installing postgis with homebrew worked for me. –  Casey Jan 3 '12 at 17:42
add comment

Esse erro aconteceu comigo, mas foi justamente pq tinha dois servidores (8.4 e 9.1) instalados, a solução foi remover a versão 8.4.

Translation

This error happened to me, but it was actually because I had two servers (8.4 and 9.1) installed. The solution was to remove the 8.4 version.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.