如何修复 Mac 上的 PostgreSQL 安装错误?

如何修复 Mac 上的 PostgreSQL 安装错误?

在 MacOsX 上安装 PostgreSQL 时遇到以下错误:

sh-3.2# sudo port install postgresql84-server
--->  Computing dependencies for postgresql84-server
--->  Staging postgresql84-server into destroot
Error: Target org.macports.destroot returned: shell command failed (see log for details)
Log for postgresql84-server is at: /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_databases_postgresql84-server/postgresql84-server/main.log
Error: Status 1 encountered during processing.
To report a bug, see <http://guide.macports.org/#project.tickets>
sh-3.2# tail  /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_databases_postgresql84-server/postgresql84-server/main.log
:info:destroot ./Library missing (directory not created: File exists)
:debug:destroot Executing org.macports.destroot (postgresql84-server)
:info:destroot chown: postgres: Invalid argument
:info:destroot shell command "chown -R postgres:postgres /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_databases_postgresql84-server/postgresql84-server/work/destroot/opt/local/var/log/postgresql84" returned error 1
:error:destroot Target org.macports.destroot returned: shell command failed (see log for details)
:debug:destroot Backtrace: shell command failed (see log for details)
    while executing
"$procedure $targetname"
:info:destroot Warning: the following items did not execute (for postgresql84-server): org.macports.activate org.macports.destroot org.macports.install
:notice:destroot Log for postgresql84-server is at: /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_databases_postgresql84-server/postgresql84-server/main.log
sh-3.2# chown -R postgres:postgres /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_databases_postgresql84-server/postgresql84-server/work/destroot/opt/local/var/log/postgresql84
chown: postgres: Invalid argument
sh-3.2# groups
wheel com.apple.access_screensharing daemon kmem sys tty operator procview procmod everyone staff certusers _appstore localaccounts admin _lpadmin _lpoperator _developer com.apple.sharepoint.group.2
sh-3.2# su postgres
su: unknown login: postgres
sh-3.2#

有人能告诉我如何安装 PostgreSQL 的正确方法吗?

我应该手动创建用户 postgres 并将 postgres 分组吗?

答案1

--- /opt/local/var/macports/sources/rsync.macports.org/release/tarballs/ports/databases/postgresql91-server/Portfile.old    2012-03-25 01:43:40.000000000 +0800
+++ /opt/local/var/macports/sources/rsync.macports.org/release/tarballs/ports/databases/postgresql91-server/Portfile    2012-03-25 01:34:29.000000000 +0800
@@ -26,8 +26,8 @@
 set libdir     ${prefix}/lib/postgresql91
 set dbdir      ${prefix}/var/db/postgresql91/defaultdb
 set logdir     ${prefix}/var/log/postgresql91
-set dbuser     postgres
-set dbgrp      postgres
+set dbuser     _postgres
+set dbgrp      _postgres

 startupitem.create yes
 startupitem.init   \

相关内容