【发布时间】:2015-04-08 22:39:03
【问题描述】:
我想为我在OSX Yosemite 中开发的节点项目安装PostgreSQL。我使用 MacPorts,所以尝试了这里描述的方法:https://github.com/codeforamerica/ohana-api/wiki/Installing-PostgreSQL-with-MacPorts-on-OS-X
...但在第 2 步中出现错误:
$ sudo gem install pg -- --with-pg-config=/opt/local/lib/postgresql93/bin/pg_config > ruby_error
ERROR: Error installing pg:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb --with-pg-config=/opt/local/lib/postgresql93/bin/pg_config
Using config values from /opt/local/lib/postgresql93/bin/pg_config
checking for libpq-fe.h... yes
checking for libpq/libpq-fs.h... yes
checking for pg_config_manual.h... yes
checking for PQconnectdb() in -lpq... no
checking for PQconnectdb() in -llibpq... no
checking for PQconnectdb() in -lms/libpq... no
Can't find the PostgreSQL client library (libpq)
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
...考虑到我可能不需要安装 pg gem,因为我想使用 Node 而不是 Ruby,我继续进行下一步。但是在第 3.3 步中我遇到了一个错误:
$ sudo su postgres -c '/opt/local/lib/postgresql93/bin/initdb -D /opt/local/var/db/postgresql93/defaultdb'
shell-init: error retrieving current directory: getcwd: cannot access parent directories: Permission denied
could not identify current directory: Permission denied
could not identify current directory: Permission denied
could not identify current directory: Permission denied
The program "postgres" is needed by initdb but was not found in the
same directory as "initdb".
Check your installation.
...检查我的 /opt/local/lib/postgresql93/bin/ 目录,我看到了 initdb 和 postgres。我看到那些行说Permission denied,我想知道那是什么意思。
不知道如何进行。考虑使用 Postgres.app 如果它真的更容易但不确定使用 MacPorts 安装是否更好,因为我使用 MacPorts 安装大多数其他东西。感谢您提供有关我的任何问题的提示!
【问题讨论】:
-
你似乎比指南做的更多;有原因吗?编辑:另外,我们可以看到 mkmf.log 吗?
-
我最终安装了 PostgresApp,但我认为你是对的,我的 sudo-ing 超出了必要的范围。一旦我回到这个项目,我会带着你要求的信息回来。
标签: postgresql osx-yosemite macports