In mascos with postgres 15:
rm /usr/local/var/postgresql@15/postmaster.pid && brew services restart postgresql@15