OS X上的Postgres无法findpostgis扩展控制文件

使用Mac OSX Yosemite 10.10.1。 我卸载并重新安装postgres和postgis与自制软件。 我明白,postgres正在寻找postgis控制文件的错误的地方。 还注意到'哪个psql'path似乎不正确。 如何/在哪里解决这个问题?

PSQL

(9.4.0, server 9.3.5) ERROR: could not open extension control file "/usr/local/Cellar/postgresql/9.3.5_1/share/postgresql/extension/postgis.control": No such file or directory 

find/ usr -name postgis.control

 /usr/local/Cellar/postgresql/9.4.0/share/postgresql/extension/postgis.control 

哪个psql

 /usr/local/bin/psql 

其中pg_config

 /usr/local/bin/pg_config 

酿造信息postgis

 postgis: stable 2.1.5, HEAD http://postgis.net /usr/local/Cellar/postgis/2.1.5 (45 files, 8.6M) * Built from source From: https://github.com/Homebrew/homebrew/blob/master/Library/Formula/postgis.rb 

酿造信息postgres

 postgresql: stable 9.4.0 (bottled) http://www.postgresql.org/ Conflicts with: postgres-xc /usr/local/Cellar/postgresql/9.4.0 (3049 files, 74M) * Poured from bottle From: https://github.com/Homebrew/homebrew/blob/master/Library/Formula/postgresql.rb 

.bashrc和.bash_profile都有

 export PGDATA='/usr/local/Cellar/postgresql/9.4.0/bin/postgres' alias postgres-log='cd /usr/local/var/postgres/ && subl server.log' 

mdfind -name“postgres”| grep -G“postgres $”

 /usr/local/Cellar/postgresql/9.4.0/bin/postgres /usr/local/var/postgres /Users/lionelramos/macports/var/macports/sources/rsync.macports.org/release/tarballs/ports/ruby/rb-postgres 

看起来像我有不同的本地版本的postgres除了自制版本。

我如何解决我的问题:

  1. 我卸载postgres 9.3.5_1与brew uninstall postgres 9.3.5_1
  2. 我用brew uninstall postgis
  3. 确保我只有postgres 9.4安装了brew info postgres
  4. 确保psql命令工作。
  5. 我用brew install postgis重新brew install postgis

这解决了我的问题。 如果您在步骤4中遇到问题,则可能需要使用initdb或createdb命令来创build所需的数据库。