10
votes

I was trying to install the postgres through terminal on mac os. I used homebrew to install the postgres. During the install I got following error

"Error: The brew link step did not complete successfully The formula built, but is not symlinked into /usr/local Could not symlink share/man/man3/SPI_connect.3"

I also got error regarding initdb

"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. Warning: The post-install step did not complete successfully You can try again using brew postinstall postgresql"

After the install I am not able to run any of postgres commands. I would really appreciate any help as I am new to postgres. Please, provide little explanation.

Thank You!

2

2 Answers

3
votes

Not sure if this solution is the best, but so far this is the only one.

Note: I did this on a macOS environment

I have chowned the directory I wasn't allowed to write. (chown -R user/usr/local/lib/pkgconfig) /usr/local/lib/pkgconfig` (assumed that dir should be mine anyway - since it's within /usr/local)

I ran brew link postgres - so the links required are there

Then initdb /usr/local/var/postgres -E utf8 worked perfectly.

0
votes

Running brew postinstall postgres --debug gives:

Errno::EACCES: Permission denied @ dir_s_mkdir - /usr/local/var/postgres

Creating the directory manually and setting the right group worked:

cd /usr/local/var
sudo mkdir postgres
sudo chown <user> postgres
sudo chgrp admin postgres/