re: dev.to open source help/discussion thread (v0) VIEW POST

FULL DISCUSSION
 

I was running into an error around gem install pg after bundle install ran for a while.

I followed the instructions here to fix it

 

I also ran into an issue during bundle install where pg failed to install.

Fetching pg 1.1.4
Installing pg 1.1.4 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /Users/sleeve/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/pg-1.1.4/ext
/Users/sleeve/.rbenv/versions/2.6.1/bin/ruby -I /Users/sleeve/.rbenv/versions/2.6.1/lib/ruby/2.6.0 -r
./siteconf20190305-63813-1cef7ua.rb extconf.rb
checking for pg_config... no
No pg_config... trying anyway. If building fails, please try again with
 --with-pg-config=/path/to/pg_config

I went with the recommended quick install method for PostgreSQL and just installed the macOS app. It looks like this unfortunately causes an issue in bundle install where it can't find the pg_config file. I tried to follow the instructions in the referenced blog post above but some of the commands are actually written/formatted incorrectly. I was able to find the pg_config file within the app package though.

/Applications/Postgres.app/Contents/Versions/11/bin/pg_config

Once I found that, I ran the following command to get pg installed.

~ $ sudo gem install pg -- --with-pg-config=/Applications/Postgres.app/Contents/Versions/11/bin/pg_config

Then I was able to rerun bundle install and it completed successfully.

code of conduct - report abuse