In Rails, Couldn't create database for {“adapter”=>“postgresql”,

前端 未结 9 2109
醉话见心
醉话见心 2020-12-14 03:34

I\'m trying to run rake db:create or rake db:setup but I get the following error. It\'s strange because rake db:create it\'s working f

9条回答
  •  庸人自扰
    2020-12-14 04:04

    I installed PG on Mac OS X via Homebrew (I didn't realize it came default in Mac OS X), and had the same problem. I may have made the problem worse by installing the pg gem before installing pg via Homebrew.

    I solved this same problem by doing the following:

    1. Make sure that all binaries are pointing to binaries in Cellar directory (/usr/local/Cellar on Mac OS X)
    2. Uninstall pg gem gem uninstall pg
    3. Reinstall with Homebrew configs gem install pg -- --with-pg-config=/usr/local/bin/pg_config (if you created a rails project with pg setup, this is explained in your database.yml config file)

    And it worked!

提交回复
热议问题