Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
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
postgres$ which psql
postgres$ pg_config --pkglibdir

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


Does this tell anyone anything?

delirium:~ ap257$ otool -L /usr/local/pgsql/lib/
        /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
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/

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
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

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 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

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.


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

The file /usr/local/Cellar/postgresql9/9.0.17/lib/ is missing. This error happened after brew upgrade and the solution is to uninstall postgis and reinstall it with:

brew uninstall postgis15

brew install postgis15

The result should be: PostGIS plugin libraries installed to: /usr/local/Cellar/postgresql9/9.0.17/lib

So afterwards you should find the file /usr/local/Cellar/postgresql9/9.0.17/lib/

share|improve this answer

Your Answer


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