尝试在 Homebrew 上运行 postgresql 时出现权限被拒绝错误

jjk*_*jkl 5 postgresql homebrew

我跑了brew install postgresql

  1. 然后brew services start postgresql

已收到 Error: Permission denied @ apply2files - /Users/$USER/Library/LaunchAgents/homebrew.mxcl.postgresql.plist

  1. chmod 755 ~/Library/LaunchAgents并且 cp /usr/local/opt/postgresql/homebrew.mxcl.postgresql.plist ~/Library/LaunchAgents/(来自https://coreyward.svbtle.com/fixing-homebrew-postgres-installation-on-macos-catalina

这给了我Error: Permission denied @ rb_sysopen - /Users/$USER/Library/LaunchAgents/homebrew.mxcl.postgresql.plist

  1. 我从这个线程https://gist.github.com/irazasyed/7732946尝试了各种事情,但没有成功。

我对 Homebrew 不太熟悉,想知道如何解决这个问题。谢谢!

小智 15

我在 Macbook Air m1 上运行。

当我跑步时:

brew services start postgresql
Run Code Online (Sandbox Code Playgroud)

我收到以下错误:

Error: Permission denied @ rb_sysopen - /Users/<username>/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
Run Code Online (Sandbox Code Playgroud)

我没有执行您发布的操作,而是执行了以下操作:

sudo chown <username> /Users/<username>/Library/LaunchAgents/
Run Code Online (Sandbox Code Playgroud)

这让它发挥作用。我从这个github线程中得到了这个想法:https://github.com/Homebrew/homebrew-services/issues/177#issuecomment-450432567