ずっと止まってたプロジェクトを久しぶりにイジる事になったので、ローカルPCで久々にRails sを叩いたらPG::ConnectionBadで怒られた。
rm /usr/local/var/postgres/postmaster.pid
launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
結論これで直ったった。
参考: https://gist.github.com/taea/8865831
参考URLの方が詳しく説明してくれてますが、Postgresqlをちゃんと終了していなかったので、.pidファイルが残ってしまっていた模様です。
ps aux | grep postgres
を叩いてプロセスを見ながら上手く解説してあります。
詳しく知りたい方は参考URLの記事を読むと良いと思います。
最初はPostgresqlが起動してないのかな?と思って
postgres -D /usr/local/var/postgres
を叩いたのですが、そのpidは使われているよ的なメッセージで怒られました。。
FATAL: pre-existing shared memory block (key 5432001, ID 65536) is still in use
HINT: If you're sure there are no old server processes still running, remove the shared memory block or just delete the file "postmaster.pid".
ちゃんとHINT: に古いプロセスがまだ動いてるよって書いてありますね。
.pidを削除するため、色々検索していたら上記の記事にたどり着きました。
感謝です。