0

Possible Duplicate:
Installing postgres gem when database is on a different server

I'm deploying a Rails app and for the first time I am running PostgreSQL on a separate machine from the app.

Bundler fails while trying to install the pg gem on my app server:

An error occured while installing pg (0.14.1), and Bundler cannot continue.
Make sure that `gem install pg -v '0.14.1'` succeeds before bundling.
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

I assume this is because the pg gem can't find the development headers or conf file for PostgreSQL and indeed it won't because PostgreSQL isn't installed on the app server, it's running on a seperate machine.

So what would be the best solution here? Should I install PostgreSQL on the app server purely so that Bundler can build the pg gem? Can I install the pg gem somehow without PostgreSQL being installed? Or can I somehow point Bundler to the PostgreSQL instance on another machine to get what it needs to build the gem?

S-Man
  • 22,521
  • 7
  • 40
  • 63
Bruce
  • 387
  • 3
  • 14
  • 1
    What OS are you installing the app on? – Jesse Wolgamott Sep 21 '12 at 20:53
  • 2
    You don't need to install the entirety of PostgreSQL to build the `pg` gem or any other client. [`libpq`](http://www.postgresql.org/docs/9.2/static/libpq.html) will suffice. – willglynn Sep 21 '12 at 21:05
  • Thanks for the quick responses. willglynn: Thanks, that is exactly the solution I needed. mu: You're right, this is a duplicate of the thread you linked to, sorry. I'm fairly new to Stackoverflow, I can't see how to mark an answer as correct, maybe these are all comments, not answers? Or perhaps I should delete this question because it's a dupe? Thanks. – Bruce Sep 21 '12 at 21:28

0 Answers0