【问题标题】:Heroku pg:psql not working - PATH not correct?Heroku pg:psql 不工作 - 路径不正确?
【发布时间】:2023-03-23 16:32:02
【问题描述】:

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

The local psql command could not be located

For help installing psql, seearticle 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 不太熟悉。

非常感谢您的帮助。

你好,法比安

【问题讨论】:

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


    【解决方案1】:

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

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

    【讨论】:

    • 我使用 Postgres.app。这种情况下是否也需要用自制软件安装本地副本?
    • 我也使用 Postgress.app。但是安装 homebrew 的 postgresql 是获取 heroku toolbelt 正在寻找的 psql 客户端二进制文件的最简单方法。您实际上不会运行 postgresql 服务器。
    • 通过 brew 安装 postgresql 完成这项工作。非常感谢@dankohn
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-07-02
    • 2018-11-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-12-27
    相关资源
    最近更新 更多