PG错误无法连接到服务器:连接被拒绝服务器是否在端口5432上运行?

我最近更新了我的机器(运行Mountain Lion的MacBook Pro),从那时起,每当我设置一个rails项目时,我的机器就会崩溃,无法连接到PG。 目前,这是我尝试去localhost时遇到的错误;

PG :: ERROR无法连接到服务器:连接被拒绝服务器是否在主机“localhost”上运行
(:1)并接受端口5432上的TCP / IP连接? 无法连接到服务器:连接
拒绝服务器是否在主机“localhost”(127.0.0.1)上运行并接受端口5432上的TCP / IP连接? 无法连接到服务器:连接被拒绝服务器是否在主机“localhost”(fe80 :: 1)上运行并接受端口5432上的TCP / IP连接?

这是一份清单,以及我尝试的事项清单;

  1. PostgreSQL版本是9.3.4
  2. 我通过HomeBrew安装它
  3. 我在我的database.yml文件中有host: localhost
  4. Rails版本4.1.1,ruby 2.0.0p247(2013-06-27修订版41674)[x86_64-darwin12.5.0]
  5. 然后brew install postgresql brew uninstall postgresql然后brew install postgresql
  6. 试图访问我的postgres.conf文件,但不允许通过PGAdmin和命令行
  7. 然后locate pg_hba.conf并终端出来了;

     WARNING: The locate database (/var/db/locate.database) does not exist. 
  8. 我也试过使用rails 4.0,但我仍然遇到了问题

  9. 在我更新计算机之前,我仍然可以在我的机器上处理启动/完成的其他项目。

  10. 当我从终端运行psql ,我得到psql: 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"?

我真的迷失在这里,不知道还能做什么。 任何帮助将非常感激。

更新:

感谢这个问题,只需下载Postgres.app for Mac即可解决所有问题。 一切都很好。

这比你想象的要容易得多,因为如果你更新你的mac,那么进程正在运行,但/usr/local/var/postgres/ here中缺少postmaster.pid文件。 所以你需要为postgres开始创建postmaster.pid的进程。

如果进展正在运行 –

手动停止:

 pg_ctl -D /usr/local/var/postgres stop -s -m fast 

手动启动:

 pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start 

现在一切正在……