error: connection to server on socket "/tmp/.s.PGSQL.5432" failed: No such file or directory
Is the server running locally and accepting connections on that socket?
psql
명령어로 postgresql 을 실행하려다 위와 같은 에러가 뜨면서 실행이 되지 않았다. 이런 경우,
iMac ~ % rm /opt/homebrew/var/postgres/postmaster.pid
iMac ~ % brew services restart postgresql
Stopping `postgresql`... (might take a while)
==> Successfully stopped `postgresql` (label: homebrew.mxcl.postgresql)
==> Successfully started `postgresql` (label: homebrew.mxcl.postgresql)
iMac ~ % psql postgres
brew services restart postgresql
후 다시 psql
을 실행하면 제대로 작동한다.