3

I've just installed Postgres 9.3.4 and PostGIS 2.1 on OSX Mavericks using the very latest versions of the KyngChaos libraries. This is a new machine, and I deliberately haven't installed Postgres using Homebrew or Macports.

However, when I try to create spatial extensions on a database, I can't, because Postgres claims not to be able to see the extension file:

:~ anna$ psql -d land -c "CREATE EXTENSION postgis;"
ERROR:  could not open extension control file 
"/usr/local/Cellar/postgresql/9.3.4/share/postgresql/extension/postgis.control":
No such file or directory

It looks as though the file is located somewhere else:

:~ anna$ mdfind postgis.control
/usr/local/pgsql-9.3/share/extension/postgis.control

I'm definitely using the expected version of Postgres, although I don't know it's actually the Kyngchaos version:

:~ anna$ psql --version
psql (PostgreSQL) 9.3.4

:~ anna$ which psql
/usr/local/pgsql-9.3/bin/psql

It looks like perhaps there are multiple versions of Postgres floating around on my system, and I'm using the wrong one?

:~ anna$ mdfind -name "postgres" | grep -G "postgres$"
/usr/local/pgsql-9.3/bin/postgres
/usr/local/var/postgres
/usr/local/Cellar/postgresql/9.3.4/bin/postgres

Can anyone advise me on what to do next?


FURTHER UPDATE

Here's the output of pg_config:

BINDIR = /usr/local/pgsql-9.3/bin
DOCDIR = /usr/local/pgsql-9.3/share/doc
INCLUDEDIR = /usr/local/pgsql-9.3/include
PKGINCLUDEDIR = /usr/local/pgsql-9.3/include
INCLUDEDIR-SERVER = /usr/local/pgsql-9.3/include/server
LIBDIR = /usr/local/pgsql-9.3/lib
PKGLIBDIR = /usr/local/pgsql-9.3/lib
LOCALEDIR =
MANDIR = /usr/local/pgsql-9.3/man
SHAREDIR = /usr/local/pgsql-9.3/share
SYSCONFDIR = /usr/local/pgsql-9.3/etc
PGXS = /usr/local/pgsql-9.3/lib/pgxs/src/makefiles/pgxs.mk
CONFIGURE = '--with-openssl' '--with-pam' '--with-krb5' '--with-gssapi' '--with-ldap' '--enable-thread-safety' '--with-bonjour' '--with-python' '--without-perl' '--enable-nls' '--with-libxml' 'CC=clang' 'CXX=clang++' 'CFLAGS=-Os -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.7.sdk -D_FILE_OFFSET_BITS=64' 'LD=clang' 'LDLFAGS=-arch x86_64 -isysroot /Developer/SDKs/MacOSX10.7.sdk'
CC = gcc
CPPFLAGS = -I/usr/include/libxml2
CFLAGS = -Os -arch x86_64 -D_FILE_OFFSET_BITS=64 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -fno-strict-aliasing -fwrapv
CFLAGS_SL =
LDFLAGS = -arch x86_64 -Wl,-dead_strip_dylibs
LDFLAGS_SL =
LIBS = -lintl -liconv -lxml2 -lpam -lssl -lcrypto -lgssapi_krb5 -ledit -lz
VERSION = PostgreSQL 9.3.4
  • You've definitely got at least two versions there. Where did the Cellar one come from? That seems to be the one you are using from the error note in the create extension. How did you start up your postgresql service? – LR1234567 May 19 '14 at 1:14
  • Thanks. In the end the answer - as always with PostGIS installation questions, I find - was to uninstall all versions of Postgres / PostGIS from my machine, and start again from scratch. – Richard May 20 '14 at 22:06
2

You need to also install postgis-scripts as included in the following, which solved the same issue for me: StackOverflow Answer

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.