PG::ConnectionBad: could not connect to server: No such file or directoryというエラーがでた
解決法
1,ターミナルでdesktopの前に行く。
2,
$ cd /usr/local/var/log/
3,
$ cat postgres.log
そうすると以下のようなエラーがでる
dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.62.dylib
Referenced from: /usr/local/bin/postgres
4,以下の記事を参考に実行
https://qiita.com/eightfoursix/items/bf11693b085eced95e29
4-1
$ brew upgrade
4-2
$ brew postgresql-upgrade-database
自分の場合は、これで解決しました。