22

When trying to start postgresql

➜  ~ brew services start postgresql
Warning: Use postgresql@14 instead of deprecated postgresql
Bootstrap failed: 5: Input/output error
Try re-running the command as root for richer errors.
Error: Failure while executing; `/bin/launchctl bootstrap gui/501 /Users/josh/Library/LaunchAgents/[email protected]` exited with 5.

Getting "error" as status when running brew services list

➜  ~ brew services list
Name          Status     User File
postgresql@14 error  256 root ~/Library/LaunchAgents/[email protected]

PSQL was working perfectly fine, shut down my laptop (did not update) and when I turned it on the next day psql was not working. I am on OSX Version 12.6 (Monteray).

6 Answers 6

23

I had the same issue on 13.0 on M1 pro, all is did was brew services restart postgresql@14, it shut down, restarted and ran fine, issue gone.

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you. I encountered the same issue with mysql service and this solution also worked for it.
16

Had the same error today 🤓 on my Mac Ventura 13.0. Did these steps and it helped.

  1. Run rm /usr/local/var/postgresql@{YOUR_VERSION}/postmaster.pid to remove postmaster.pid file. this is usually caused by an error in the postmaster.pid file.
  2. Run brew services stop postgresql to stop the current postgresql service.
  3. Then finally run brew services start postgresql, a new postmaster.pid file will be generated.

If this doesn't work you can run brew doctor and see if it will return Your system is ready to brew. If there are warnings 🥶, you can share them here with the community for more details.?

1 Comment

For me it was /usr/local/var/postgres/postmaster.pid (no version suffix even though i use brew services start postgresql@14 to run it)
5

For Apple Silicon M1/M2 Mac OS Ventura 13.x.x ,following steps worked for me:

  1. cd /opt/homebrew/var/postgres/
  2. Check if postmaster.pid file exists by ls postmaster.pid
  3. If it exists, run rm postmaster.pid
  4. Finally,run brew services restart postgresql.
  5. Check the status brew services list

1 Comment

What cause thus behaviour?
4

Had the same issue, but couldn't get Postgres 14 working, and ended up just upgrading to Postgres 15, which I did get to work.

The steps looked like this (version numbers might vary)

brew services stop postgresql@14
brew install postgresql@15
# This command will copy data over to the new database
brew /opt/homebrew/Cellar/postgresql@15/15.1/bin/pg_upgrade -b /opt/homebrew/Cellar/postgresql@14/14.6/bin/ -d /opt/homebrew/var/postgres/ -D /opt/homebrew/var/postgresql@15/
brew services start postgresql@15

2 Comments

Just FYI, the command brew /opt/homebrew/Cellar/postgresql@15/15.1/bin/pg_upgrade -b /opt/homebrew/Cellar/postgresql@14/14.6/bin/ -d /opt/homebrew/var/postgres/ -D /opt/homebrew/var/postgresql@15/ didn't work
this didn't work
1

In my case, I had postgresql@13 and postgresql@14 install with brew on Ventura 13.1

I first removed postgresql@13 and all data within :

brew remove postgresql@13 and rm -rf /usr/local/var/postgresql@13

This assure me that the previous folder is fully remove, however, I did not care about my local data ... you may want to take care of it before doing this

After that, I reinstall postgresql@14 within the following commands :

# Remove postgresql 14 with brew 
brew remove postgresql@14

# Reinstall postgresql 14 with brew
brew install postgresql@14

# Remove all the files in the db folder
rf -rf /usr/local/var/postgresql@14/*

# Kill all process that run any db of the postgresql 14 folder 
pkill -f /usr/local/var/postgresql@14   
   
# Initialize the db folder for postgresql 14 
initdb --locale=C -E UTF-8 /usr/local/var/postgresql@14

# Restart postgresql with brew (should say that it's already running) 
brew services start postgresql@14

1 Comment

Only this solution helped me. Thanks. Works on M-chip. Macos Sonoma
1

I encountered this for my mysql when I was trying brew services start mysql today:

Bootstrap failed: 5: Input/output error
Try re-running the command as root for richer errors.
Error: Failure while executing; `/bin/launchctl bootstrap gui/501 /Users/wzx/Library/LaunchAgents/homebrew.mxcl.mysql.plist` exited with 5.

The following steps worked for me: delete the directory /opt/homebrew/var/mysql, then brew uninstall mysql and brew install mysql

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.