Robert Samarji
Robert Samarji

Reputation: 113

Error installing PostgreSQL via Homebrew on Mac

When installing PostgreSQL via Homebrew on Mac (OSX 10.11.6) I get the following errors:

Error: The `brew link` step did not complete successfully The formula
  built, but is not symlinked into /usr/local

and

initdb: file "/usr/local/share/postgresql/postgres.bki" does not exist
  This might mean you have a corrupted installation or identified the 
  wrong directory with the invocation option -L.

The /postgresql folder doesn't exist.

Not sure if it's relevant, but I already have OpenSSL 1.0.2o_2 and Readline 7.0.5 installed via Homebrew.

Does anyone know why this error occurs and how I can solve it?

Upvotes: 4

Views: 4712

Answers (2)

ChrisM
ChrisM

Reputation: 141

In my case, I had installed libpq which prevented postgresql from linking. Unlinking libpq followed by linking postgresql fixed the issue for me.

brew unlink libpq
brew link postgresql
brew postinstall postgresql

Upvotes: 14

Robert Samarji
Robert Samarji

Reputation: 113

Managed to solve the problem. It's a permissions issue. The original answer can be found here: Homebrew: Could not symlink, /usr/local/bin is not writable

In short, perform the following commands:

sudo chown -R `whoami`:admin /usr/local/bin
sudo chown -R `whoami`:admin /usr/local/share
sudo chown -R `whoami`:admin /usr/local/opt

Upvotes: 0

Related Questions