5: Input/output error Error: Failure while executing; `/bin/launchctl bootstrap gui/502 and FATAL: password authentication failed for user
Asked Answered
N

11

44

The error 5: Input/output Error: Failure while executing; /bin/launchctl bootstrap gui/502 /Users/Andrea/Library/LaunchAgents/homebrew.mxcl.postgresql.plist exited with 5 is occurring when typing in the command "brew services start postgresql".

I am trying to create a database using homebrew and postgresql. If I type the command "brew services stop postgresql" and then start it back up the error does not occur. But will reoccur on the initial start of postgresql.

After, I stop postgresql and restart it using homebrew I type in "createdb 'test'. This error appears:

"error: could not connect to database template1: FATAL: password authentication failed for user "Andrea". Initially I tried to primarily work on the password authentication with no luck.

Here are the steps I have taken:

  1. I have changed the method column to trust in my hba_pg files.
  2. I have tried the command ALTER in the terminal to change the password.
  3. I created a root login on my computer, where I tried to access the file and use the root's password to create the database.
  4. The command chpass to change my user's password.

Help would be much appreciated. Thank you!

Nickel answered 7/9, 2021 at 21:34 Comment(1)
In my case, I have started the service as root when it first failed. Re-installing didn't fix in that case. I had to stop it as root before starting as a normal user sudo brew services stop postgresql@14 brew services start postgresql@14 Traynor
F
82

This is what I did to resolve on my Mac.

  1. Looked at the postgres.log cat /usr/local/var/log/postgres.log | tail -100
  2. Found the following error on my logs FATAL: lock file "postmaster.pid" already exists
  3. Fix above PID issue and restart the server.
rm /usr/local/var/postgres/postmaster.pid 
brew services restart postgresql
Forging answered 15/9, 2021 at 13:14 Comment(4)
Thank you! This was very helpful. I got a different error looking into the log, it was this: ``` 2021-10-20 12:06:41.065 IST [50107] FATAL: database files are incompatible with server 2021-10-20 12:06:41.065 IST [50107] DETAIL: The data directory was initialized by PostgreSQL version 13, which is not compatible with this version 14.0. "root" execution of the PostgreSQL server is not permitted. ``` So I had to ensure I was installing the right version of Postgres.Mallissa
I have the same error, but my error log says: "root" execution of the PostgreSQL server is not permitted. The server must be started under an unprivileged user ID to prevent possible system security compromise. See the documentation for more information on how to properly start the server. Not sure why as it isn't being launched as root.Natty
On M1 macs this folder is at /opt/homebrew/var/postgresHampden
On M1 macs, in order to check the logs, they're found in /opt/homebrew/var/logConclave
E
47

Sometimes this can be solved by simply running

brew services restart postgresql

instead of

brew services start postgresql

It happens when a previous postgres process doesn't terminate properly (maybe because you killed a psql process in activity monitor or otherwise). Restarting appears to properly unlock/delete the postmaster.pid file where "start" doesn't.

Epiphysis answered 3/11, 2021 at 23:58 Comment(2)
Did the trick for me. Thanks!Stodder
It all makes sense now.Trinary
B
10

On the m1 mac I had the same issue and had to remove the postmaster.pid file as well. For m1 macs, the file is at /opt/homebrew/var/postgres/postmaster.pid, so I ran

/opt/homebrew/var/postgres/postmaster.pid

and I could brew services start postgresql successfully.

Battista answered 9/11, 2021 at 1:16 Comment(2)
Other macs may have it at: /usr/local/var/postgres/postmaster.pid OR /Users/[name]/Library/'Application Support'/Postgres/var/postmaster.pid I added a bash script: rm /opt/homebrew/var/postgresql@10/postmaster.pid && brew services restart postgresql@10 you may have to slightly tweak thisCrayton
in my case it was in: /usr/local/var/postgresql@12/postmaster.pidSaenz
S
4

To build on what @gajen-sunthara said, I made sure to upgrade my postgresql installation:

brew upgrade postgresql

Then removed the postmaster.pid:

rm /usr/local/var/postgres/postmaster.pid 

And restarted postgresql:

brew services restart postgresql

And that should get it going again :)

Serving answered 20/9, 2021 at 1:33 Comment(1)
brew services upgrade postgresql gave me an error but brew upgrade postgresql let me installed a newer version of postgres. Just thought I'd mention it. :)Collum
C
3

The other answers didn't apply because I didn't have the pid file (or many other files in those directories). The same error was caused by a bad install, most likely because I had previously installed libpq to get the psql CLI in isolation previously as per: Correct way to install psql without full Postgres on macOS?.

Solution, clean install:


  >  brew uninstall postgresql
  >  brew uninstall libpq

  >  brew install postgresql
  >  brew services run postgresql

Comport answered 14/7, 2022 at 18:55 Comment(0)
S
2

For me it is working after doing this, I use mac intel chip. I have installed potgres using brew

$rm /usr/local/var/postgresql@14/postmaster.pid
$brew services restart postgresql
Subacute answered 29/6, 2023 at 11:28 Comment(0)
A
1

Restart instead of start, and specify version:

brew services restart postgresql@12
Stopping `postgresql@12`... (might take a while)
==> Successfully stopped `postgresql@12` (label: homebrew.mxcl.postgresql@12)
==> Successfully started `postgresql@12` (label: homebrew.mxcl.postgresql@12)
Adz answered 28/6, 2023 at 23:38 Comment(0)
P
0

I got the same error:

% brew services start yabai
Bootstrap failed: 5: Input/output error
Try re-running the command as root for richer errors.
Error: Failure while executing; `/bin/launchctl bootstrap gui/503 /Users/myuser/Library/LaunchAgents/
homebrew.mxcl.yabai.plist` exited with 5.

I have an extra user who manages brew called brew. After trying to run a brew service with sudo, this was a solution (on Apple silicon):

% sudo brew services stop yabai
% sudo chmod -R g+w /opt/homebrew 
% sudo chown -R brew /opt/homebrew 
% brew services start yabai
Philately answered 14/1, 2023 at 21:23 Comment(0)
H
0

I have similar case with mysql, when I run:

brew services start mysql

It show : Failture while executing; /bin/launchctl bootstrap gui/1952607496 /Users/root/Library/LaunchAgents/homebrew.mxcl.mysql.plist exited with 5

All I have to do is run following line and start server again

rm /Users/root/Library/LaunchAgents/homebrew.mxcl.my
sql.plist
Hyphenated answered 30/5, 2023 at 14:32 Comment(0)
L
0

please remove

rm /opt/homebrew/var/postgresql@16/postmaster.pid 

After postgresql@16 will restart automatically.

Losel answered 15/3, 2024 at 10:24 Comment(0)
H
-2

I know this has already been answered, but for anyone seeing this in the future, here is some help.

This often happens because it wasn't properly stopped when it was used at a different time, and the version you are using now has a conflict with what you were running previously. There are a few ways to fix it.

  1. Try stoping it with brew services stop postgresql
  2. Start it with brew services start postgresql

You can also just do brew services restart postgresql and not do step 1 and 2. Hope this helps someone!

Henbane answered 23/6, 2022 at 19:19 Comment(2)
That's just repeats an existing answer.Crossover
Okay? So does that mean I can’t phrase it in a way that I think is more helpful? Or in a way I think people will understand more? I’m trying to understand what the intention of your comment was? There’s multiple people repeating things in different ways in this thread? Why am I the only one you’re saying this to?Henbane

© 2022 - 2025 — McMap. All rights reserved.