Fixing Homebrew Postgres Installation on macOS Catalina

I recently upgraded to macOS Catalina and needed to reinstall PostgreSQL via Homebrew. The usual process is simple enough: brew install postgresql does the bulk of the work, and then running brew services start postgres would normally result in Homebrew’s service manager loading the appropriate launch agent for you.

Unfortunately Catalina’s various file access protection schemes seem to get in the way of this. I saw a handful of different errors when looking for a solution, but the specific error I was receiving was a little different:

Permission denied @ rb_sysopen - /Users/corey/Library/LaunchAgents/homebrew.mxcl.postgresql.plist

I assumed that the plist file had merely been given incorrect permissions, but the file wasn’t even there. Homebrew wasn’t able to create the file because the directory, ~/Library/LaunchAgents has its permissions set to 555 (i.e. r-xr-xr-x), so despite being owned by my login user, I wasn’t able to write to the folder directly.

The solution is to change the directory permissions to allow writing by the owner, then copy the missing plist file over manually from the postgres install:

% chmod 755 ~/Library/LaunchAgents
% cp /usr/local/opt/postgresql/homebrew.mxcl.postgresql.plist ~/Library/LaunchAgents/

From there, re-running brew services start postgresql should operate correctly.

 
29
Kudos
 
29
Kudos

Now read this

How to fix TypeError: Nil is not a Symbol or String

If you’re using the form helpers built into Rails (or a library like SimpleForm that’s built on top of them), you might run into a somewhat confusing error: TypeError: nil is not a symbol nor a string Usually this will originate from... Continue →