Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error when start the postgres service with homebrew using Mac OS

I installed postgresql 10 with the classic command:

brew install postgresql@10

Then I started the service:

brew services start postgresql@10

The output says:

Successfully started postgresql@10 (label: homebrew.mxcl.postgresql@10)

but when I run this command:

brew services

This is what I get:

Name          Status  User         Plist
cassandra     stopped              
postgresql    stopped              
postgresql@10 error   username /opt/homebrew/opt/postgresql@10/[email protected]  

It seems that the service in not running correctly. Previously I had another version of Posgresql. It was the version 10 again but installed with the installer offered but the postgresql's webpage. However I should have removed it.

I check with this command to see used ports:

lsof -nP +c 15 | grep LISTEN

and I don't have services using the port 5432 (the default port used by postgresql).

like image 992
SGiux Avatar asked Dec 31 '25 16:12

SGiux


1 Answers

I shared the procedure to investigate further and maybe solve the problem.

  1. Check the file /opt/homebrew/opt/postgresql@10/[email protected]. This path is given by the brew services command.
  2. Open the file and see where the log is written. In my case:
<key>StandardErrorPath</key>
<string>/opt/homebrew/var/log/[email protected]</string>
  1. Look at the log. I my case I saw that there was a file locked, probably by the previous instance of postgresql that didn't release the lock. The restart of my Mac solved the issue.
like image 189
SGiux Avatar answered Jan 02 '26 10:01

SGiux



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!