⚠この方法ではデータベースのデータが削除されるのでご注意ください。
PC内で複数環境をつくっていたら、ぶっ壊れて、このようなエラーがでた。
[1] pry(main)> User.all
Hirb Error: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
環境
- macOS
- Homebrew
- Rails
- PostgreSQL
解決方法
以下のコマンドで解決できました。
$ rm -rf /usr/local/var/postgres
$ initdb /usr/local/var/postgres
special thanks