关于osx mountain lion:在Mac上使用Homebrew的PostgreSQL

PostgreSQL with Homebrew on Mac

首先我使用自制软件并安装postgresql,我得到了这条成功消息:

==> Summary ?? /usr/local/Cellar/postgresql/9.2.2: 2819 files, 39M, built in 68 seconds

然后我需要运行这个命令:

1
initdb `brew --prefix`/var/postgres -E utf8

但这是我得到的信息:
我该怎么办?
也在OSX 10.8.2上运行

The files belonging to this database system will be owned by user
"JonyIve". This user must also own the server process.

The database cluster will be initialized with locale"en_US.UTF-8".
The default text search configuration will be set to"english".

initdb: directory"/usr/local/var/postgres" exists but is not empty If
you want to create a new database system, either remove or empty the
directory"/usr/local/var/postgres" or run initdb with an argument
other than"/usr/local/var/postgres".


假设这是一个新安装,而不是重新安装,我认为解决您的问题非常简单:

1
initdb `brew --prefix`/var/postgres/DATA -E utf8

通常,数据目录称为"数据",位于postgresql主目录下。这允许共享日志文件访问等的可能性。


如果您知道可以在不破坏任何内容的情况下执行此操作,则另一个选项始终只是根据消息删除目录

remove or empty the directory"/usr/local/var/postgres"

通过

rm -rf /usr/local/var/postgres