我已经安装了postgresql,但是它说我没有链接到它。我正在命令行中运行这个程序,并得到以下错误:
myname@MacBook-Pro-8 ~> brew install postgresql
Warning: postgresql 10.4 is already installed, it's just not linked
You can use `brew link postgresql` to link this version.
myname@MacBook-Pro-8 ~> brew link postgresql
Linking /usr/local/Cellar/postgresql/10.4...
Error: Could not symlink share/man/man7/ABORT.7
/usr/local/share/man/man7 is not writable.
myname@MacBook-Pro-8 ~> sudo brew link postgresql
Password:
Error: Running Homebrew as root is extremely dangerous and no longer supported.
As Homebrew does not drop privileges on installation you would be giving all build scripts full access to your system.我也试过:
brew prune; brew link postgresql这给了我同样的错误:
Error: Could not symlink share/man/man7/ABORT.7
/usr/local/share/man/man7 is not writable.为什么那个文件夹是不可写的,我能做什么来改变它呢?
发布于 2018-06-19 19:53:16
解决这个问题真的很痛苦,所以我想我会把它留给别人看看。
问题: Postgresql的 Homebrew安装不会成功执行。$ brew链接postgresql由于目录不可写而导致失败。新版本的Homebrew将不允许sudo命令和系统完整性保护防止更改权限。
详细信息:我试着用自制软件安装postgres,但一直遇到syslink的问题。当我按照自制软件运行$ brew link postgresql时,我一直遇到一个错误,因为某些文件夹是不可写的,所以无法完成。我认为通过运行sudo可以很容易地解决这一问题,但不幸的是,最新版本的国产软件不再允许使用sudo命令,这是因为安全风险。我的下一个想法是给我的根用户,并使用macOS GUI界面来更改这个文件夹的权限,因为我不知道如何在终端上这样做。不管是以“root”身份登录,OS都不允许我更改文件夹的权限。我还尝试使用sudo并更改终端中的权限,但它也没有工作。几天后,我的头撞在墙上,尝试各种事情来寻找解决方案,我发现自从El Capitan,macOS引入了系统完整性保护,也就是'SIP‘或’无根‘。事实证明,一旦我禁用了SIP,登录回'root‘,并更改了我的常规帐户权限来读取/写入问题目录,我就能够回到我的常规帐户并成功地执行$ brew postgresql。
(假设您目前已经通过自制安装了postgresql,但无法链接到上面提到的场景,下面是我建议您解决问题的建议.)
$ brew link postgresql$ brew uninstall postgresql,然后运行$ brew update和$ brew doctor。如果这些都已设置,则运行$ brew install postgresql。$ brew link postgresql以找出有问题的目录,并与其他目录一起重复步骤5-10,这会给您带来麻烦。)检查一切正常。我建议运行$ brew services、start、postgresql然后运行$ createdb 'test'。在我的例子中,当我最初尝试运行createdb并得到“命令未找到”时,我才意识到有些地方不对劲。)
发布于 2018-07-13 18:13:28
运行这个程序就能解决问题。这绕过了SIP。
sudo chown -R $(whoami) $(brew --prefix)/*
brew link postgresqlhttps://stackoverflow.com/questions/50933539
复制相似问题