[英]Linking postgresql in homebrew
I already installed postgresql, but it says I did not link to it. 我已经安装了postgresql,但是它说我没有链接到它。 I am running this in the command line and getting the following error: 我在命令行中运行此命令并收到以下错误:
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.
I also tried: 我也尝试过:
brew prune; brew link postgresql
which gave me the same error: 这给了我同样的错误:
Error: Could not symlink share/man/man7/ABORT.7
/usr/local/share/man/man7 is not writable.
Why is that folder not writable and what can I do to change that? 为什么该文件夹不可写?我该怎么做才能更改它?
It was really painful solving this problem, so I figured I would leave it here for others to see. 解决这个问题真的很痛苦,所以我想把它留给别人看看。
Issue: Homebrew install of Postgresql will not execute successfully. 问题: Postgresql的Homebrew安装将无法成功执行。 $ brew link postgresql results in failure due to directory not writable. $ brew link postgresql由于目录不可写而导致失败。 New version of Homebrew will not allow sudo commands and System Integrity Protection prevents changing permissions. 新版本的Homebrew将不允许sudo命令,并且系统完整性保护可防止更改权限。
Details: I tried to use homebrew to install postgres and kept running into issues with syslink. 详细信息:我尝试使用自制软件安装postgres,并不断遇到syslink问题。 When I ran $ brew link postgresql
as homebrew suggested, I kept running into an error that it couldn't be completed because certain folders were not writable. 当我按照自制软件的建议运行$ brew link postgresql
,我一直遇到一个错误,因为某些文件夹不可写,所以无法完成。 I thought this would be easily remedied by running sudo but unfortunately the most current version of homebrew no longer allows the use of sudo commands due to security risks. 我认为通过运行sudo可以很容易地解决此问题,但是不幸的是,由于安全风险,最新版本的homebrew不再允许使用sudo命令。 My next thought was to my root user and use the macOS GUI interface to change the permissions on this folder because I am not sure how to do this on the terminal. 我的下一个想法是让我的root用户使用macOS GUI界面来更改此文件夹的权限,因为我不确定如何在终端上执行此操作。 Regardless of being logged in as 'root,' the OS would not let me change the permissions of the folder. 不管以“ root”身份登录,操作系统都不允许我更改文件夹的权限。 I also attempted to use sudo and change the permissions in terminal and it did not work either. 我也尝试使用sudo并在终端中更改权限,但是它也不起作用。 After several days of banging my head against the wall try all kinds of things to find a solution, I discovered that since El Capitan, macOS introduced System Integrity Protection aka 'SIP' or 'rootless.' 经过几天的脑筋急转弯尝试各种解决方案,我发现自El Capitan以来,macOS引入了系统完整性保护(又称为“ SIP”或“无根”)。 As it turned out, once I disabled SIP, logged back into 'root' and changed my regular accounts permissions to Read/Write on the problem directories, I was able to go back to my regular account and successfully execute $ brew install postgresql. 事实证明,一旦我禁用了SIP,重新登录到“ root”并在问题目录上将我的常规帐户权限更改为“读/写”,就可以返回我的常规帐户并成功执行$ brew install postgresql。
(Assuming you currently have postgresql installed through homebrew but unable to link due a scenario like the one mentioned above, here is what I suggest to resolve your issue...) (假设您当前通过自制软件安装了postgresql,但由于上述情况而无法链接,这是我建议您解决的问题...)
$ brew link postgresql
运行$ brew link postgresql
$ brew uninstall postgresql
, then $ brew update
and $ brew doctor
. 回到您的常规帐户,运行$ brew uninstall postgresql
,然后运行$ brew update
和$ brew doctor
。 If those are all set run $ brew install postgresql
. 如果所有这些都设置,运行$ brew install postgresql
。 $ brew link postgresql
to figure out the problematic directory and repeat Steps 5 - 10 with whatever other directories are giving you trouble. 但是,如果再次遇到链接和权限问题,请运行$ brew link postgresql
以找出有问题的目录,并对其他给您带来麻烦的目录重复执行步骤5-10。 (To check that everything is working. I recommend running $ brew services
start postgresql then $ createdb 'test'
. In my case, it was when I originally tried to run createdb and got "command not found" that I realized something was wrong.) (要检查一切是否正常。我建议先运行$ brew services
然后启动postgresql,然后运行$ brew services
$ createdb 'test'
。就我而言,这是当我最初尝试运行createdb并得到“找不到命令”时,我意识到出了点问题。 )
Running this solves it. 运行此即可解决。 This gets around SIP. 这绕过SIP。
sudo chown -R $(whoami) $(brew --prefix)/*
brew link postgresql
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.