Heroku pg:psql无法正常工作 - PATH不正确?

时间:2014-04-22 22:03:04

标签: ruby-on-rails ruby macos postgresql heroku

我想连接到heroku pg:psql,但它不再工作了。在搜索网络和Stackoverflow几个小时之后,不知道该怎么做。 命令heroku pg:psql给了我这个错误:

The local psql command could not be located

For help installing psql, see article about local-postgres

使用OS X(版本10.9.1),Ruby 1.9.3在Mac上工作。和Rails 4.0.1。

我的database.yml如下:

development:
adapter: postgresql
encoding: unicode
database: outspotly_v1_development
pool: 5
username: fabianwydler
host: localhost
port: 5432

test:
adapter: postgresql
encoding: unicode
database: outspotly_v1_test
pool: 5
username: fabianwydler
host: localhost
port: 5432

production:
adapter: postgresql
encoding: unicode
database: outspotly_v1_production
pool: 5
username: fabianwydler
host: 
port:

我的$ PATH可能有问题吗?

heroku run rails db
Running `rails db` attached to terminal... up, run.3540
Couldn't find database client: psql. Check your $PATH and try again.
Fabians-MacBook-Pro:outspotly_v1 fabianwydler$ echo $PATH
/Users/fabianwydler/.rvm/gems/ruby-1.9.3-p194/bin:/Users/fabianwydler/.rvm/gems/ruby-              1.9.3-p194@global/bin:/Users/fabianwydler/.rvm/rubies/ruby-1.9.3-p194/bin:/Users/fabianwydler/.rvm/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin

如果$ PATH错了,我不知道如何处理这个问题,因为我在Mac上并不那么熟悉。

非常感谢你的帮助。

问候,法比安

1 个答案:

答案 0 :(得分:1)

您需要安装psql的本地副本。到目前为止,最简单的方法是安装homebrew然后安装postgresql:

ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)" brew install postgresql