John Petit


50 Experience
0 Lessons Completed
0 Questions Solved


Posted in Error installing gem pg on Mac with

The pg gem will not install. Getting:

ERROR:  Error installing pg:
    ERROR: Failed to build gem native extension.

    current directory: /Library/Ruby/Gems/2.3.0/gems/pg-1.1.4/ext
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby -r ./siteconf20191212-99334-1rync8p.rb extconf.rb
mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/include/ruby.h

extconf failed, exit code 1

Gem files will remain installed in /Library/Ruby/Gems/2.3.0/gems/pg-1.1.4 for inspection.

I have tried
sudo gem install pg -- --with-pg-config=/Applications/
sudo ARCHFLAGS="-arch x86_64" gem install pg

bundle config --with-pg-config=/Applications/
sudo gem install pg -- --with-postgres-include-dir=/Applications/ --with-postgres-lib-dir=/Applications/

All the same error

Is there a solution to this?

logo Created with Sketch.

Ruby on Rails tutorials, guides, and screencasts for web developers learning Ruby, Rails, Javascript, Turbolinks, Stimulus.js, Vue.js, and more. Icons by Icons8

© 2021 GoRails, LLC. All rights reserved.