[英]Linking postgresql in homebrew
我已經安裝了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.
為什么該文件夾不可寫?我該怎么做才能更改它?
解決這個問題真的很痛苦,所以我想把它留給別人看看。
問題: Postgresql的Homebrew安裝將無法成功執行。 $ brew link postgresql由於目錄不可寫而導致失敗。 新版本的Homebrew將不允許sudo命令,並且系統完整性保護可防止更改權限。
詳細信息:我嘗試使用自制軟件安裝postgres,並不斷遇到syslink問題。 當我按照自制軟件的建議運行$ brew link postgresql
,我一直遇到一個錯誤,因為某些文件夾不可寫,所以無法完成。 我認為通過運行sudo可以很容易地解決此問題,但是不幸的是,由於安全風險,最新版本的homebrew不再允許使用sudo命令。 我的下一個想法是讓我的root用戶使用macOS GUI界面來更改此文件夾的權限,因為我不確定如何在終端上執行此操作。 不管以“ root”身份登錄,操作系統都不允許我更改文件夾的權限。 我也嘗試使用sudo並在終端中更改權限,但是它也不起作用。 經過幾天的腦筋急轉彎嘗試各種解決方案,我發現自El Capitan以來,macOS引入了系統完整性保護(又稱為“ SIP”或“無根”)。 事實證明,一旦我禁用了SIP,重新登錄到“ root”並在問題目錄上將我的常規帳戶權限更改為“讀/寫”,就可以返回我的常規帳戶並成功執行$ brew install postgresql。
(假設您當前通過自制軟件安裝了postgresql,但由於上述情況而無法鏈接,這是我建議您解決的問題...)
$ brew link postgresql
$ brew uninstall postgresql
,然后運行$ brew update
和$ brew doctor
。 如果所有這些都設置,運行$ brew install postgresql
。 $ brew link postgresql
以找出有問題的目錄,並對其他給您帶來麻煩的目錄重復執行步驟5-10。 (要檢查一切是否正常。我建議先運行$ brew services
然后啟動postgresql,然后運行$ brew services
$ createdb 'test'
。就我而言,這是當我最初嘗試運行createdb並得到“找不到命令”時,我意識到出了點問題。 )
運行此即可解決。 這繞過SIP。
sudo chown -R $(whoami) $(brew --prefix)/*
brew link postgresql
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.