# Error installing gem pg on Mac with Postgress.app

**URL:** <https://www.ruby-forum.com/t/error-installing-gem-pg-on-mac-with-postgress-app/253498>\
**Category:** Uncategorized\
**Created:** [December 18, 2019, 4:20am UTC](https://www.ruby-forum.com/t/error-installing-gem-pg-on-mac-with-postgress-app/253498 "2019-12-18T04:20:17Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Forbin](https://www.ruby-forum.com/user_avatar/www.ruby-forum.com/forbin/32/1266_2.png) [@Forbin](https://www.ruby-forum.com/u/Forbin)\
**Post date:** [December 18, 2019, 4:20am UTC](https://www.ruby-forum.com/t/error-installing-gem-pg-on-mac-with-postgress-app/253498/1 "2019-12-18T04:20:17Z")

</div>

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/Postgres.app/Contents/Versions/9.3/bin/pg_config`  
and  
`sudo ARCHFLAGS="-arch x86_64" gem install pg`

and  
`bundle config build.pg --with-pg-config=/Applications/Postgres.app/Contents/Versions/9.3/bin/pg_config`  
and  
`sudo gem install pg -- --with-postgres-include-dir=/Applications/PostgresOld.app/Contents/Versions/9.3/include/ --with-postgres-lib-dir=/Applications/PostgresOld.app/Contents/Versions/9.3/lib/`

All the same error

Is there a solution to this?
