Failed to build gem native extension on macOS - ruby

I want to run this workflow called TarSynFlow (https://github.com/seoanezonjic/TarSynFlow). It has some requirements that I am trying to install, but am hitting some issues, specifically with installing scbi_distributed_blast. The TarSynFlow github page and original source (https://github.com/dariogf/scbi_distributed_blast) for this say to type:
gem install scbi_distributed_blast
Tried this but get the following:
Building native extensions. This could take a while...
ERROR: Error installing scbi_distributed_blast:
ERROR: Failed to build gem native extension.
current directory: /Users/user_name/.rvm/gems/ruby-3.0.0/gems/eventmachine-1.2.7/ext
/Users/ginamchaput/.rvm/rubies/ruby-3.0.0/bin/ruby -I
/Users/ginamchaput/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0 -r ./siteconf20210830-52462-idkyvy.rb extconf.rb
checking for -lcrypto... yes
checking for -lssl... yes
checking for openssl/ssl.h... yes
checking for openssl/err.h... yes
checking for rb_trap_immediate in ruby.h,rubysig.h... no
checking for rb_thread_blocking_region()... no
checking for rb_thread_call_without_gvl() in ruby/thread.h... yes
checking for rb_thread_fd_select()... yes
checking for rb_fdset_t in ruby/intern.h... yes
checking for rb_wait_for_single_fd()... yes
checking for rb_enable_interrupt()... no
checking for rb_time_new()... yes
checking for inotify_init() in sys/inotify.h... no
checking for __NR_inotify_init in sys/syscall.h... no
checking for writev() in sys/uio.h... yes
checking for pipe2() in unistd.h... no
checking for accept4() in sys/socket.h... no
checking for SOCK_CLOEXEC in sys/socket.h... no
checking for sys/event.h... yes
checking for sys/queue.h... yes
checking for clock_gettime()... yes
checking for CLOCK_MONOTONIC_RAW in time.h... yes
checking for CLOCK_MONOTONIC in time.h... yes
CXXFLAGS= -Wall -Wextra -Wno-deprecated-declarations -Wno-ignored-qualifiers -Wno-unused-result -Wno-address
creating Makefile
current directory: /Users/user_name/.rvm/gems/ruby-3.0.0/gems/eventmachine-1.2.7/ext
make "DESTDIR=" clean
current directory: /Users/user_name/.rvm/gems/ruby-3.0.0/gems/eventmachine-1.2.7/ext
make "DESTDIR="
compiling binder.cpp
In file included from binder.cpp:20:
./project.h:119:10: fatal error: 'openssl/ssl.h' file not found
#include <openssl/ssl.h>
^~~~~~~~~~~~~~~
1 error generated.
make: *** [binder.o] Error 1
make failed, exit code 2
Gem files will remain installed in /Users/user_name/.rvm/gems/ruby-3.0.0/gems/eventmachine-1.2.7 for inspection.
Results logged to /Users/user_name/.rvm/gems/ruby-3.0.0/extensions/x86_64-darwin-20/3.0.0/eventmachine-1.2.7/gem_make.out
I did see other posts suggest using sudo gem install scbi_distributed_blast ; I did try it but same error.
I'm using macOS Big Sur; XCode v 12.5.1; ruby (installed via RVM) v 3.0.0p0; If anyone has advice to get this installed that would be great!

From this:
./project.h:119:10: fatal error: 'openssl/ssl.h' file not found
looks like you need ssl dev libraries to compile the gem. If you have xcode installed, try with:
xcode-select --install
Another way to install the required libs is to use homebrew with:
brew install openssl
brew link openssl --force
Update
If you have all the required libraries installed, then try installing eventmachine by itself, but specifying the path where the ssl libraries are located.
gem install eventmachine -- --with-cppflags=-I/usr/local/opt/openssl/include
then, try installing scbi_distributed_blast again.

Related

RubyGems Error while installing Jekyll 'openssl/ssl.h' file not found

I am trying to install Jekyll on my Mac (gem install jekyll) using RubyGems but I'm running into the error below.
Building native extensions. This could take a while...
ERROR: Error installing jekyll:
ERROR: Failed to build gem native extension.
current directory: /Users/nikhilanand/.rvm/gems/ruby-3.0.2/gems/eventmachine-1.2.7/ext
/Users/nikhilanand/.rvm/rubies/ruby-3.0.2/bin/ruby -I /Users/nikhilanand/.rvm/rubies/ruby-3.0.2/lib/ruby/3.0.0 -r ./siteconf20210816-54247-5zijii.rb extconf.rb
checking for -lcrypto... yes
checking for -lssl... yes
checking for openssl/ssl.h... yes
checking for openssl/err.h... yes
checking for rb_trap_immediate in ruby.h,rubysig.h... no
checking for rb_thread_blocking_region()... no
checking for rb_thread_call_without_gvl() in ruby/thread.h... yes
checking for rb_thread_fd_select()... yes
checking for rb_fdset_t in ruby/intern.h... yes
checking for rb_wait_for_single_fd()... yes
checking for rb_enable_interrupt()... no
checking for rb_time_new()... yes
checking for inotify_init() in sys/inotify.h... no
checking for __NR_inotify_init in sys/syscall.h... no
checking for writev() in sys/uio.h... yes
checking for pipe2() in unistd.h... no
checking for accept4() in sys/socket.h... no
checking for SOCK_CLOEXEC in sys/socket.h... no
checking for sys/event.h... yes
checking for sys/queue.h... yes
checking for clock_gettime()... yes
checking for CLOCK_MONOTONIC_RAW in time.h... yes
checking for CLOCK_MONOTONIC in time.h... yes
CXXFLAGS= -Wall -Wextra -Wno-deprecated-declarations -Wno-ignored-qualifiers -Wno-unused-result -Wno-address
creating Makefile
current directory: /Users/nikhilanand/.rvm/gems/ruby-3.0.2/gems/eventmachine-1.2.7/ext
make DESTDIR\= clean
current directory: /Users/nikhilanand/.rvm/gems/ruby-3.0.2/gems/eventmachine-1.2.7/ext
make DESTDIR\=
compiling binder.cpp
In file included from binder.cpp:20:
./project.h:119:10: fatal error: 'openssl/ssl.h' file not found
#include <openssl/ssl.h>
^~~~~~~~~~~~~~~
1 error generated.
make: *** [binder.o] Error 1
make failed, exit code 2
Gem files will remain installed in /Users/nikhilanand/.rvm/gems/ruby-3.0.2/gems/eventmachine-1.2.7 for inspection.
Results logged to /Users/nikhilanand/.rvm/gems/ruby-3.0.2/extensions/arm64-darwin-20/3.0.0/eventmachine-1.2.7/gem_make.out
I tried brew install openssl but it says that openssl is already installed, and I also tried gem install eventmachine -- --with-cppflags=-I/usr/local/opt/openssl/include but I'm getting the same error 'openssl/ssl.h' file not found.
Could someone point out how to fix this issue here?
You might need to run brew link --force openssl first.
Then gem install eventmachine -- --with-cppflags=-I/usr/local/opt/openssl/include
I had the same issue and this worked for me:
gem install eventmachine -v '1.2.7' -- --with-cppflags=-I/usr/local/opt/openssl/include
I had to specify the version. Without it, it still failed 🤷

Rails Error Running Gem Install PG

I am trying to push my app to Heroku and I configured my gemfile as such:
group :production do
gem 'pg', '0.18.4'
gem 'rails_12factor', '0.0.2'
gem 'puma'
end
And I am getting this error in my console when running bundle install:
An error occurred while installing pg (0.18.4), and Bundler cannot continue.
Make sure that `gem install pg -v '0.18.4'` succeeds before bundling.
Then when I run gem install pg -v '0.18.4', I get the following:
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /Library/Ruby/Gems/2.0.0 directory.
When I run sudo gem install pg -v '0.18.4'
I get the following:
ERROR: Error installing pg:
ERROR: Failed to build gem native extension.
current directory: /Library/Ruby/Gems/2.0.0/gems/pg-0.18.4/ext
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby -r ./siteconf20160125-5501-ugsd1s.rb extconf.rb
checking for pg_config... yes
Using config values from /usr/local/bin/pg_config
checking for libpq-fe.h... yes
checking for libpq/libpq-fs.h... yes
checking for pg_config_manual.h... yes
checking for PQconnectdb() in -lpq... no
checking for PQconnectdb() in -llibpq... no
checking for PQconnectdb() in -lms/libpq... no
Can't find the PostgreSQL client library (libpq)
*** 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.
UPDATE
I reinstalled RVM and rails and now when I run gem install pg -v '0.18.4', it runs successfully:
Successfully installed pg-0.18.4
Parsing documentation for pg-0.18.4
Done installing documentation for pg after 3 seconds
1 gem installed
But when run bundle install, I get this:
Installing pg 0.18.4 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /Users/benwong/Desktop/ruby/rails_projects/blog2/vendor/bundle/ruby/2.2.0/gems/pg-0.18.4/ext
/Users/benwong/.rvm/rubies/ruby-2.2.1/bin/ruby -r ./siteconf20160126-44660-1ufenyc.rb extconf.rb --with-pg-config=/Applications/Postgres.app/Contents/MacOS/bin/pg_config
Using config values from /Applications/Postgres.app/Contents/MacOS/bin/pg_config
sh: /Applications/Postgres.app/Contents/MacOS/bin/pg_config: No such file or directory
sh: /Applications/Postgres.app/Contents/MacOS/bin/pg_config: No such file or directory
checking for libpq-fe.h... yes
checking for libpq/libpq-fs.h... yes
checking for pg_config_manual.h... yes
checking for PQconnectdb() in -lpq... yes
checking for PQconnectionUsedPassword()... yes
checking for PQisthreadsafe()... yes
checking for PQprepare()... yes
checking for PQexecParams()... yes
checking for PQescapeString()... yes
checking for PQescapeStringConn()... yes
checking for PQescapeLiteral()... yes
checking for PQescapeIdentifier()... yes
checking for PQgetCancel()... yes
checking for lo_create()... yes
checking for pg_encoding_to_char()... yes
checking for pg_char_to_encoding()... yes
checking for PQsetClientEncoding()... yes
checking for PQlibVersion()... yes
checking for PQping()... yes
checking for PQsetSingleRowMode()... yes
checking for PQconninfo()... yes
checking for rb_encdb_alias()... yes
checking for rb_enc_alias()... yes
checking for rb_thread_call_without_gvl()... yes
checking for rb_thread_call_with_gvl()... yes
checking for rb_thread_fd_select()... yes
checking for rb_w32_wrap_io_handle()... no
checking for rb_str_modify_expand()... yes
checking for rb_hash_dup()... yes
checking for PGRES_COPY_BOTH in libpq-fe.h... yes
checking for PGRES_SINGLE_TUPLE in libpq-fe.h... yes
checking for PG_DIAG_TABLE_NAME in libpq-fe.h... yes
checking for struct pgNotify.extra in libpq-fe.h... yes
checking for unistd.h... yes
checking for inttypes.h... yes
checking for ruby/st.h... yes
checking for C99 variable length arrays... yes
creating extconf.h
creating Makefile
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/Users/benwong/Desktop/ruby/rails_projects/blog2/vendor/bundle/ruby/2.2.0/extensions/x86_64-darwin-14/2.2.0-static/pg-0.18.4/mkmf.log
current directory: /Users/benwong/Desktop/ruby/rails_projects/blog2/vendor/bundle/ruby/2.2.0/gems/pg-0.18.4/ext
make "DESTDIR=" clean
current directory: /Users/benwong/Desktop/ruby/rails_projects/blog2/vendor/bundle/ruby/2.2.0/gems/pg-0.18.4/ext
make "DESTDIR="
compiling gvl_wrappers.c
compiling pg.c
compiling pg_binary_decoder.c
compiling pg_binary_encoder.c
compiling pg_coder.c
compiling pg_connection.c
pg_connection.c:2394:3: warning: implicit declaration of function 'gettimeofday' is invalid in C99 [-Wimplicit-function-declaration]
gettimeofday(&currtime, NULL);
^
1 warning generated.
compiling pg_copy_coder.c
compiling pg_errors.c
compiling pg_result.c
compiling pg_text_decoder.c
compiling pg_text_encoder.c
compiling pg_type_map.c
compiling pg_type_map_all_strings.c
compiling pg_type_map_by_class.c
compiling pg_type_map_by_column.c
compiling pg_type_map_by_mri_type.c
compiling pg_type_map_by_oid.c
compiling pg_type_map_in_ruby.c
compiling util.c
linking shared-object pg_ext.bundle
ld: warning: directory not found for option '-L/Users/haven/.sm/pkg/active/lib'
ld: file not found: dynamic_lookup
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [pg_ext.bundle] Error 1
make failed, exit code 2
Gem files will remain installed in /Users/benwong/Desktop/ruby/rails_projects/blog2/vendor/bundle/ruby/2.2.0/gems/p
g-0.18.4 for inspection.
Results logged to /Users/benwong/Desktop/ruby/rails_projects/blog2/vendor/bundle/ruby/2.2.0/extensions/x86_64-darwin-14/2.2.0-static/pg-0.18.4/gem_make.out
Using puma 2.15.3
Using rails_serve_static_assets 0.0.4
Using rails_stdout_logging 0.0.4
Using sass 3.4.21
Using tilt 2.0.2
Using spring 1.6.2
Using rdoc 4.2.1
Using tzinfo 1.2.2
Using nokogiri 1.6.7.2
Using rack-test 0.6.3
Using warden 1.2.4
Using mail 2.6.3
Using binding_of_caller 0.7.2
Using coffee-script 2.4.1
Using uglifier 2.7.2
Using sprockets 3.5.2
An error occurred while installing pg (0.18.4), and Bundler cannot continue.
Make sure that `gem install pg -v '0.18.4'` succeeds before bundling.
You need to have PostgreSQL installed to install pg gem. Also PATHs will need to be configured.
You can use http://postgresapp.com/ to easily install PostgreSQL on Mac. And use this to configure PATH: http://postgresapp.com/documentation/cli-tools.html
Try this it worked for me it must Have all psql dependency so it will work
sudo apt-get install -y libpq-dev build-essential postgresql-server-dev-all libpgsql-ruby postgresql ruby-dev && gem install pg

Can't install pg gem on Yosemite

I am trying to bundle install my Gemfile at Yosemite, I have pg listed, but I get this error:
Installing pg 0.18.1 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/Users/Apple/.rvm/rubies/ruby-2.2.2/bin/ruby -r ./siteconf20150811-78520-18pzkkt.rb extconf.rb
checking for pg_config... yes
Using config values from /usr/local/php5/bin/pg_config
checking for libpq-fe.h... yes
checking for libpq/libpq-fs.h... yes
checking for pg_config_manual.h... yes
checking for PQconnectdb() in -lpq... yes
checking for PQconnectionUsedPassword()... yes
checking for PQisthreadsafe()... yes
checking for PQprepare()... yes
checking for PQexecParams()... yes
checking for PQescapeString()... yes
checking for PQescapeStringConn()... yes
checking for PQescapeLiteral()... yes
checking for PQescapeIdentifier()... yes
checking for PQgetCancel()... yes
checking for lo_create()... yes
checking for pg_encoding_to_char()... yes
checking for pg_char_to_encoding()... yes
checking for PQsetClientEncoding()... yes
checking for PQlibVersion()... yes
checking for PQping()... yes
checking for PQsetSingleRowMode()... yes
checking for PQconninfo()... yes
checking for PQhostaddr()... no
checking for rb_encdb_alias()... yes
checking for rb_enc_alias()... yes
checking for rb_thread_call_without_gvl()... yes
checking for rb_thread_call_with_gvl()... yes
checking for rb_thread_fd_select()... yes
checking for rb_w32_wrap_io_handle()... no
checking for rb_str_modify_expand()... yes
checking for rb_hash_dup()... yes
checking for PGRES_COPY_BOTH in libpq-fe.h... yes
checking for PGRES_SINGLE_TUPLE in libpq-fe.h... yes
checking for PG_DIAG_TABLE_NAME in libpq-fe.h... yes
checking for struct pgNotify.extra in libpq-fe.h... yes
checking for unistd.h... yes
checking for ruby/st.h... yes
creating extconf.h
creating Makefile
make "DESTDIR=" clean
make "DESTDIR="
compiling gvl_wrappers.c
compiling pg.c
compiling pg_binary_decoder.c
compiling pg_binary_encoder.c
compiling pg_coder.c
compiling pg_connection.c
compiling pg_copy_coder.c
compiling pg_errors.c
compiling pg_result.c
compiling pg_text_decoder.c
compiling pg_text_encoder.c
compiling pg_type_map.c
compiling pg_type_map_all_strings.c
compiling pg_type_map_by_class.c
compiling pg_type_map_by_column.c
compiling pg_type_map_by_mri_type.c
compiling pg_type_map_by_oid.c
compiling pg_type_map_in_ruby.c
compiling util.c
linking shared-object pg_ext.bundle
couldn't understand kern.osversion `14.1.0'
ld: warning: directory not found for option '-L/Users/haven/.sm/pkg/active/lib'
ld: -rpath can only be used when targeting Mac OS X 10.5 or later
collect2: ld returned 1 exit status
Makefile:253: recipe for target 'pg_ext.bundle' failed
make: *** [pg_ext.bundle] Error 1
make failed, exit code 2
Gem files will remain installed in /Users/Apple/.rvm/gems/ruby-2.2.2#/gems/pg-0.18.1 for inspection.
Results logged to /Users/Apple/.rvm/gems/ruby-2.2.2#/extensions/x86_64-darwin-14/2.2.0-static/pg-0.18.1/gem_make.out
An error occurred while installing pg (0.18.1), and Bundler cannot continue.
Make sure that `gem install pg -v '0.18.1'` succeeds before bundling.
Any one can help?
i had plenty of problems installing pg gem in a fresh SO until i found this:
bundle failing - Can't find the PostgreSQL client library (libpq)
hope this helps you.

gem install pg error: couldn't understand kern.osversion `14.0.0' on Yosemite w/ Ruby 2.1.5

I used RVM to install Ruby-2.1.5 and ran bundle again. Now the pg gem won't install and I get this error:
gem install pg -v '0.17.1' -- --with-pg-config=/Applications/Postgres.app/Contents/Versions/9.3/bin/pg_config
Building native extensions with: '--with-pg-config=/Applications/Postgres.app/Contents/Versions/9.3/bin/pg_config'
This could take a while...
ERROR: Error installing pg:
ERROR: Failed to build gem native extension.
/Users/diego/.rvm/rubies/ruby-2.1.5/bin/ruby -r ./siteconf20141120-33258-108chh6.rb extconf.rb --with-pg-config=/Applications/Postgres.app/Contents/Versions/9.3/bin/pg_config
Using config values from /Applications/Postgres.app/Contents/Versions/9.3/bin/pg_config
checking for libpq-fe.h... yes
checking for libpq/libpq-fs.h... yes
checking for pg_config_manual.h... yes
checking for PQconnectdb() in -lpq... yes
checking for PQconnectionUsedPassword()... yes
checking for PQisthreadsafe()... yes
checking for PQprepare()... yes
checking for PQexecParams()... yes
checking for PQescapeString()... yes
checking for PQescapeStringConn()... yes
checking for PQescapeLiteral()... yes
checking for PQescapeIdentifier()... yes
checking for PQgetCancel()... yes
checking for lo_create()... yes
checking for pg_encoding_to_char()... yes
checking for pg_char_to_encoding()... yes
checking for PQsetClientEncoding()... yes
checking for PQlibVersion()... yes
checking for PQping()... yes
checking for PQsetSingleRowMode()... yes
checking for rb_encdb_alias()... yes
checking for rb_enc_alias()... yes
checking for rb_thread_call_without_gvl()... yes
checking for rb_thread_call_with_gvl()... yes
checking for rb_thread_fd_select()... yes
checking for rb_w32_wrap_io_handle()... no
checking for PGRES_COPY_BOTH in libpq-fe.h... yes
checking for PGRES_SINGLE_TUPLE in libpq-fe.h... yes
checking for PG_DIAG_TABLE_NAME in libpq-fe.h... yes
checking for struct pgNotify.extra in libpq-fe.h... yes
checking for unistd.h... yes
checking for ruby/st.h... yes
creating extconf.h
creating Makefile
make "DESTDIR=" clean
make "DESTDIR="
compiling gvl_wrappers.c
compiling pg.c
compiling pg_connection.c
compiling pg_errors.c
compiling pg_result.c
linking shared-object pg_ext.bundle
couldn't understand kern.osversion `14.0.0'
ld: warning: directory not found for option '-L/Users/mpapis/.sm/pkg/active/lib'
ld: -rpath can only be used when targeting Mac OS X 10.5 or later
collect2: ld returned 1 exit status
make: *** [pg_ext.bundle] Error 1
make failed, exit code 2
I've updated XCode to version 6.1 via the App Store. I reinstalled gcc and applegcc-4.2 via homebrew. I also reinstall Postgres.app. I've tried the suggested solutions here and here to no avail.
Anybody have any idea what to try next? For now I'm just reverting to Ruby-2.1.4 where pg installs fine.
If you set MACOSX_DEPLOYMENT_TARGET=10.9 in your environment prior to compiling the pg gem, the shared object linking should work properly.

Trouble installing pg gem

Trying to install the pg gem gives me errors.
I'm using Ruby 1.9.3-p125 built using rbenv/ruby-build. I installed PostgreSQL using the one-click installer. I'm able to connect to the DB using pgAdmin. I'm running out of ideas.
% gem install pg ~
Building native extensions. This could take a while...
ERROR: Error installing pg:
ERROR: Failed to build gem native extension.
/Users/sandropadin/.rbenv/versions/1.9.3-p125/bin/ruby extconf.rb
checking for pg_config... yes
Using config values from /usr/bin/pg_config
checking for libpq-fe.h... yes
checking for libpq/libpq-fs.h... yes
checking for pg_config_manual.h... yes
checking for PQconnectdb() in -lpq... yes
checking for PQconnectionUsedPassword()... yes
checking for PQisthreadsafe()... yes
checking for PQprepare()... yes
checking for PQexecParams()... yes
checking for PQescapeString()... yes
checking for PQescapeStringConn()... yes
checking for PQgetCancel()... yes
checking for lo_create()... yes
checking for pg_encoding_to_char()... yes
checking for pg_char_to_encoding()... yes
checking for PQsetClientEncoding()... yes
checking for rb_encdb_alias()... yes
checking for rb_enc_alias()... yes
checking for struct pgNotify.extra in libpq-fe.h... yes
checking for unistd.h... yes
checking for ruby/st.h... yes
creating extconf.h
creating Makefile
make
compiling pg.c
compiling pg_connection.c
pg_connection.c: In function ‘pgconn_wait_for_notify’:
pg_connection.c:1986: warning: ‘rb_thread_select’ is deprecated (declared at /Users/sandropadin/.rbenv/versions/1.9.3-p125/include/ruby-1.9.1/ruby/intern.h:379)
pg_connection.c: In function ‘pgconn_block’:
pg_connection.c:2512: warning: ‘rb_thread_select’ is deprecated (declared at /Users/sandropadin/.rbenv/versions/1.9.3-p125/include/ruby-1.9.1/ruby/intern.h:379)
compiling pg_result.c
linking shared-object pg_ext.bundle
ld: in /usr/local/lib/libssl.0.9.8.dylib, missing required architecture x86_64 in file for architecture x86_64
collect2: ld returned 1 exit status
make: *** [pg_ext.bundle] Error 1
Gem files will remain installed in /Users/sandropadin/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/pg-0.13.2 for inspection.
Results logged to /Users/sandropadin/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/pg-0.13.2/ext/gem_make.out
Not sure which of the following steps finally cleared this issue up. But as mu is too short mentioned, the problem was mixing 32bit and 64bit binaries.
1st, I installed this 64-bit version of PostgreSQL
2nd, I uninstalled any old Homebrew OpenSSL installation
$ brew uninstall openssl
3rd, I installed the 64-bit version of OpenSSL with Homebrew
$ brew install --64-bit openssl
Lastly, when installing the pg gem, I changed the LDFLAGS to point to the 64-bit version of OpenSSL
$ gem install pg -- --with-ldflags='-L/usr/local/Cellar/openssl/0.9.8s'

Resources