# Ruby-postgres gem installation on Leopard

**URL:** <https://www.ruby-forum.com/t/ruby-postgres-gem-installation-on-leopard/140249>\
**Category:** Rails\
**Created:** [June 12, 2008, 9:56am UTC](https://www.ruby-forum.com/t/ruby-postgres-gem-installation-on-leopard/140249 "2008-06-12T09:56:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![simon.m.fox](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/96bed5/32.png) [@simon.m.fox](https://www.ruby-forum.com/u/simon.m.fox)\
**Post date:** [June 12, 2008, 9:56am UTC](https://www.ruby-forum.com/t/ruby-postgres-gem-installation-on-leopard/140249/1 "2008-06-12T09:56:28Z")

</div>

Hi all

I am just about to start a project using rails and am trying to setup  
my enviroment with postgres as the database. I have installed postgres  
8.3.1 from source and am now having trouble installing the ruby-  
postgres gem. The following is the output trace I am getting, looks  
like a problem with headers/includes, any help is greatly appreciated.

Thanks  
Simon

sudo gem install ruby-postgres – --with-pgsql-include-dir=/usr/local/  
pgsql/include/ --with-pgsql-lib-dir=/usr/local/pgsql/lib/

Building native extensions. This could take a while…  
ERROR: Error installing ruby-postgres:  
ERROR: Failed to build gem native extension.

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby  
extconf.rb install ruby-postgres – --with-pgsql-include-dir=/usr/  
local/pgsql/include/ --with-pgsql-lib-dir=/usr/local/pgsql/lib/  
checking for main() in -lpq… yes  
checking for libpq-fe.h… yes  
checking for libpq/libpq-fs.h… yes  
checking for PQsetClientEncoding()… no  
checking for pg\_encoding\_to\_char()… no  
checking for PQfreemem()… no  
checking for PQescapeString()… no  
creating Makefile

make  
gcc -I. -I. -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/  
usr/lib/ruby/1.8/universal-darwin9.0 -I. -DHAVE\_LIBPQ\_FE\_H -  
DHAVE\_LIBPQ\_LIBPQ\_FS\_H -I/usr/local/pgsql/include -fno-common -arch  
ppc -arch i386 -Os -pipe -fno-common -Wall -c libpq-compat.c  
libpq-compat.c: In function ‘PQescapeBytea’:  
libpq-compat.c:104: warning: implicit declaration of function  
‘sprintf’  
libpq-compat.c:104: warning: incompatible implicit declaration of  
built-in function ‘sprintf’  
libpq-compat.c:104: warning: pointer targets in passing argument 1 of  
‘sprintf’ differ in signedness  
libpq-compat.c: In function ‘PQunescapeBytea’:  
libpq-compat.c:158: warning: implicit declaration of function ‘strlen’  
libpq-compat.c:158: warning: incompatible implicit declaration of  
built-in function ‘strlen’  
libpq-compat.c:158: warning: pointer targets in passing argument 1 of  
‘strlen’ differ in signedness  
libpq-compat.c: In function ‘PQescapeBytea’:  
libpq-compat.c:104: warning: implicit declaration of function  
‘sprintf’  
libpq-compat.c:104: warning: incompatible implicit declaration of  
built-in function ‘sprintf’  
libpq-compat.c:104: warning: pointer targets in passing argument 1 of  
‘sprintf’ differ in signedness  
libpq-compat.c: In function ‘PQunescapeBytea’:  
libpq-compat.c:158: warning: implicit declaration of function ‘strlen’  
libpq-compat.c:158: warning: incompatible implicit declaration of  
built-in function ‘strlen’  
libpq-compat.c:158: warning: pointer targets in passing argument 1 of  
‘strlen’ differ in signedness  
gcc -I. -I. -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/  
usr/lib/ruby/1.8/universal-darwin9.0 -I. -DHAVE\_LIBPQ\_FE\_H -  
DHAVE\_LIBPQ\_LIBPQ\_FS\_H -I/usr/local/pgsql/include -fno-common -arch  
ppc -arch i386 -Os -pipe -fno-common -Wall -c postgres.c  
postgres.c: In function ‘pgconn\_s\_escape\_bytea’:  
postgres.c:370: warning: pointer targets in passing argument 1 of  
‘PQescapeBytea’ differ in signedness  
postgres.c: In function ‘pgconn\_s\_escape\_bytea’:  
postgres.c:370: warning: pointer targets in passing argument 1 of  
‘PQescapeBytea’ differ in signedness  
postgres.c: In function ‘pgconn\_s\_unescape\_bytea’:  
postgres.c:401: warning: pointer targets in passing argument 1 of  
‘PQunescapeBytea’ differ in signedness  
postgres.c: In function ‘pgconn\_s\_unescape\_bytea’:  
postgres.c:401: warning: pointer targets in passing argument 1 of  
‘PQunescapeBytea’ differ in signedness  
postgres.c: In function ‘Init\_postgres’:  
postgres.c:2593: error: ‘pgconn\_protocol\_version’ undeclared (first  
use in this function)  
postgres.c:2593: error: (Each undeclared identifier is reported only  
once  
postgres.c:2593: error: for each function it appears in.)  
postgres.c:2594: error: ‘pgconn\_server\_version’ undeclared (first use  
in this function)  
postgres.c: In function ‘Init\_postgres’:  
postgres.c:2593: error: ‘pgconn\_protocol\_version’ undeclared (first  
use in this function)  
postgres.c:2593: error: (Each undeclared identifier is reported only  
once  
postgres.c:2593: error: for each function it appears in.)  
postgres.c:2594: error: ‘pgconn\_server\_version’ undeclared (first use  
in this function)  
lipo: can’t open input file: /var/tmp//ccOm8KcD.out (No such file or  
directory)  
make: \*\*\* [postgres.o] Error 1

Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/ruby-  
postgres-0.7.1.2006.04.06 for inspection.  
Results logged to /Library/Ruby/Gems/1.8/gems/ruby-  
postgres-0.7.1.2006.04.06/gem\_make.out

---

<div class="post-metadata">

**Author:** ![simon.m.fox](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/96bed5/32.png) [@simon.m.fox](https://www.ruby-forum.com/u/simon.m.fox)\
**Post date:** [June 12, 2008, 10:00am UTC](https://www.ruby-forum.com/t/ruby-postgres-gem-installation-on-leopard/140249/2 "2008-06-12T10:00:34Z")

</div>

On Jun 12, 8:38 am, “simon.m.fox” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Hi all
> 
> I am just about to start a project using rails and am trying to setup  
> my enviroment with postgres as the database. I have installed postgres  
> 8.3.1 from source and am now having trouble installing the ruby-  
> postgres gem. The following is the output trace I am getting, looks  
> like a problem with headers/includes, any help is greatly appreciated.

As you can seen in the trace, that gem is quite old (april 2006) i’m  
guessing it just doesn’t work with postgres 8.3. There are  
unfortunately a plethora of postgres gems, but two that are still  
actively (if i remember correctly; not a big postgres user) are  
postgres (whose rubyforge project is ruby-postgres, sigh…) and ruby-  
pg (which is the latest and greatest).  
I believe i’m correct in saying that a few tweaks to the activerecord  
adapter were needed for ruby-pg, so you should only use ruby-pg if you  
will be running rails 2.1 or higher.

Fred
