If you get the error
ERROR: Error installing pg:
ERROR: Failed to build gem native extension.
It’s because you probably have your pg_config on other location, in my case was located on /library/ you can use locate pg_config and add the option –with-pg-config=/path_of_pg_config.
If you get the error:
invalid option: –with-pg-config=/library/PostgreSQL…..
You must separate the options with — like this:
gem install pg -v ‘0.16.0’ — –with-pg-config=/path-of-pg_config