Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/macos/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Macos El Capitan上的initdb/usr/local/var/postgres_Macos_Postgresql_Osx Elcapitan - Fatal编程技术网

Macos El Capitan上的initdb/usr/local/var/postgres

Macos El Capitan上的initdb/usr/local/var/postgres,macos,postgresql,osx-elcapitan,Macos,Postgresql,Osx Elcapitan,在El Capitan上通过自制程序安装postgresql 9.5后,我试图运行initdb/usr/local/var/postgres,但我得到以下结果: The files belonging to this database system will be owned by user "kyledecot". This user must also own the server process. The database cluster will be initialized with

在El Capitan上通过自制程序安装postgresql 9.5后,我试图运行
initdb/usr/local/var/postgres
,但我得到以下结果:

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

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

Data page checksums are disabled.

fixing permissions on existing directory /usr/local/var/postgres ... initdb: could not change permissions of directory "/usr/local/var/postgres": Operation not permitted
当尝试
cd/usr/local/var/postgres
时,我得到:

cd: permission denied: /usr/local/var/postgres
看来我没有适当的权限来做这件事。我想这和卡皮坦有关,但我可能错了


如何解决这个问题?

sudo chown-R`whoami`/usr/local

我不得不将我看到的两条建议与与此问题/错误相关的堆栈溢出问题结合起来。我发现自己处于一种鸡毛蒜皮的境地,我会重新安装postgres并一次更改一个权限,但这两个命令相互冲突

所以我这样做了:

sudo chown -R `whoami` /usr/local && brew postinstall postgresql

…而且它工作得很好。

我发现它在
chown
all
/usr/local
目录中并没有真正的效率和安全性,所以我只是简单地这么做了

mkdir/usr/local/var/postgres


一切都进行得很顺利。

命令应该使用“postinstall”而不是“post install”。我用自制软件安装了一个过时的PostgeSQL,并将其卸载,删除我用
find/-name postgres
找到的所有postgresql文件,然后
mkdir/usr/local/var/postgres
让我获得了一个愉快的安装。感谢您分享完整的
chown
语法