Can't install pg gem on Mountain Lion

前端 未结 4 901
隐瞒了意图╮
隐瞒了意图╮ 2020-12-01 13:07

I have been having a lot of troubles with Rails after upgrading to Mountain Lion.

Trying to trouble shoot these and searching for hours on the internet so far I have

相关标签:
4条回答
  • 2020-12-01 13:49

    Alternatively, use the Postgres app. IMO, it's the easiest and fastest way to get up and running with PostgreSQL and Rails on Mac.

    For detailed instructions: http://blog.parsalabs.com/blog/2013/09/14/installing-postgresql-don-mac-os-x-and-using-it-as-your-rails-apps-database/

    0 讨论(0)
  • 2020-12-01 13:52

    Download the postgresSQL installer from http://www.enterprisedb.com/products-services-training/pgdownload#osx

    and then make your path look something like this:

    PATH=$PATH:/Library/PostgreSQL/9.0/bin/ gem install pg
    

    This would do!

    Note: Please specify your postgreSQL installed version correctly in the path.

    UPDATE(10/11/2015) (Taken from Heroku)

    On OS X with Homebrew:

    1. Install postgresql using:

      brew install postgresql

    2. Then install the gem using:

      gem install pg -- --with-pg-config=/usr/local/bin/pg_config

    On OS X with MacPorts:

    gem install pg -- --with-pg-config=/opt/local/lib/postgresql84/bin/pg_config

    Hope this helps!

    0 讨论(0)
  • 2020-12-01 13:53

    As banditKing says in his answer, need to tell the gem where to find the postgres binaries. You can use the binaries included with the excellent and easy postgres.app from Heroku ( http://postgresapp.com ) to install this gem instead of the EnterpriseDb version. The EnterpriseDB version is great, but an involved install for a dev machine.

    Download Postgres.app on your system and add the internal bin directory to your path. I put it in /Applications/Postgres.app, so I used

    gem install pg -- --with-pg-config=/Applications/Postgres.app/Contents/MacOS/bin/pg_config
    

    worked for me on 10.8.2, Ruby 1.9.3, pg-0.14.1, and the XCode CLI tools

    0 讨论(0)
  • 2020-12-01 14:09

    After installing Mavericks bundle update was throwing an error on the pg gem.

    I use Brew to manage my packages and postgresql was already installed, but still I was getting the 'no pg_config' error.

    The fix was to just brew uninstall postgresql, then brew install postgresql. After which I was immediately able to successfully run bundle update.

    0 讨论(0)
提交回复
热议问题