0

I am trying to write a ruby program to connect to PostgreSQL database. Since, I will be using the pg and pg_query ruby extension, I am trying to install them by running:

gem install pg

or

gem install pg -- --with-pg-config=/Library/PostgreSQL/12/bin/pg_config and am getting the following error:

This could take a while... ERROR: Error installing pg: ERROR: Failed to build gem native extension. /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby extconf.rb --with-pg-config=/Library/PostgreSQL/12/bin/pg_config Using config values from /Library/PostgreSQL/12/bin/pg_config *** extconf.rb failed *** Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options. . . . . /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:467:in `try_do': The compiler failed to generate an executable file. (RuntimeError) You have to install development tools first. from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:546:in `block in try_link0' from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/tmpdir.rb:93:in `mktmpdir' from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:543:in `try_link0' from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:570:in `try_link' from extconf.rb:40:in `<main>' 

Can someone help me get this issue resolved?

FYI - I am new to macOS and Ruby.

Thanks

2

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.