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.

 
32
Kudos
 
32
Kudos

Now read this

Fix ESLint crashing on rest operator: “Cannot read property ‘type’ of undefined”

This is a bit of an obscure one, but I tend to use the same dev tooling configuration (Prettier, ESLint, Babel, etc) for multiple projects so I’m likely to run into this again. I encountered this in the middle of a project after a VSCode... Continue →