在Mountain Lion上使用Homebrew和Rails安装postgresql [英] Installing postgresql with Homebrew and Rails on Mountain Lion

查看:84
本文介绍了在Mountain Lion上使用Homebrew和Rails安装postgresql的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在计算机上安装Postgresql时遇到很多麻烦。

I have been having a lot of trouble installing Postgresql on my computer.

我有一个Rails应用程序,该应用程序已部署到Heroku,并且想在本地使用Postgresql。机。在我下载Postgres.app之前,但从未真正使用过它,而在最近才卸载它,以为它可能会引起一些问题。

I have a Rails app that I deploy to Heroku and want to use Postgresql on my local machine. Before I downloaded Postgres.app but never really used it and recently uninstalled it thinking it may be causing some problems.

我安装Postgres并每次运行rake db:create :all,出现以下错误:

I install Postgres and every time I run rake db:create:all, I get the following error:

could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/pgsql_socket/.s.PGSQL.5432"?

我已经用Google搜索并尝试了很多方法,但仍无法弄清楚我可能最终必须得到一些个人帮助。

I've Googled and tried a bunch of things but have not been able to figure it out and thought I might finally have to get some personal help.

运行哪个psql时,我会得到:

When running which psql I get:

/usr/local/bin/psql

我尝试卸载Postgres,卸载pg并重新安装它,但没有任何效果。

I've tried uninstalling Postgres, uninstalling pg and re-installing it but nothing has been able to work.

这里有任何见解吗?谢谢。

Any insight here? Thank you.

推荐答案

如果使用homebrew进行安装,是否安装了启动守护程序以便服务器启动?

IF you are installing it with homebrew did you install the launch daemon so that the server starts up?

看看 brew information postgresql

需要初始化数据库

initdb / usr / local / var / postgres -E utf8

然后启动服务器

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

然后,您应该能够创建数据库,并在本地使用它。如果要使用它,则应按照brew中列出的说明自动启动和停止它。

Then you should be able to create your databases, and use it locally. If you are going to be using it you should follow the directions listed in brew for starting and stopping it automatically..

这篇关于在Mountain Lion上使用Homebrew和Rails安装postgresql的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆