Permission denied error when trying to run postgresql on Homebrew

Viewed 2843

I ran brew install postgresql:

  1. Then brew services start postgresql

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

  1. Ran chmod 755 ~/Library/LaunchAgents and cp /usr/local/opt/postgresql/homebrew.mxcl.postgresql.plist ~/Library/LaunchAgents/ (from https://coreyward.svbtle.com/fixing-homebrew-postgres-installation-on-macos-catalina)

This gave me Error: Permission denied @ rb_sysopen - /Users/$USER/Library/LaunchAgents/homebrew.mxcl.postgresql.plist

  1. I tried various things from this thread https://gist.github.com/irazasyed/7732946 but with no success.

I'm not too familiar with Homebrew and am wondering how to resolve this. Thanks!

2 Answers

I'm running on a Macbook Air m1.

When I ran:

brew services start postgresql

I got the following error:

Error: Permission denied @ rb_sysopen - /Users/<username>/Library/LaunchAgents/homebrew.mxcl.postgresql.plist

Instead of doing what you posted I did the following:

sudo chown <username> /Users/<username>/Library/LaunchAgents/

And that made it work. I got the idea from this github thread: https://github.com/Homebrew/homebrew-services/issues/177#issuecomment-450432567

Related