Ruby on Rails and Postgres - Installing postgresql gem

12 views
Skip to first unread message

Rodrigo Dellacqua

unread,
Jan 10, 2010, 4:55:31 PM1/10/10
to rubyonra...@googlegroups.com
Hey there,

I'm trying to get started with RoR with Postgresql.

I've been trying to find some information on it, but there's a lot of really OLD info on that subject!

What should I do to get my application working with Postgresql?

I get an error while trying to install the gem.

After reading i thought many info about alot of different gems.

Which one is the right one?

[]'s
Rodrigo Dellacqua

Marnen Laibow-Koser

unread,
Jan 10, 2010, 8:09:57 PM1/10/10
to rubyonra...@googlegroups.com
Rodrigo Dellacqua wrote:
> Hey there,
>
> I'm trying to get started with RoR with Postgresql.
>
> I've been trying to find some information on it, but there's a lot of
> really
> OLD info on that subject!
>
> What should I do to get my application working with Postgresql?
>
> I get an error while trying to install the gem.

Which gem (there are several)? What error?

>
> After reading i thought many info about alot of different gems.
>
> Which one is the right one?

I believe I'm using the postgres gem, though I'll verify that when I'm
not posting from my iPhone. :) Others have reported success with
postgres-pr (pure ruby) or pg.

Search the list archives for more, or perhaps there's information at
Robby on Rails, since he uses Postgres.

>
> []'s
> Rodrigo Dellacqua

Best,
-- 
Marnen Laibow-Koser
http://www.marnen.org
mar...@marnen.org
--
Posted via http://www.ruby-forum.com/.

Rodrigo Dellacqua

unread,
Jan 10, 2010, 8:59:13 PM1/10/10
to rubyonra...@googlegroups.com

I tried postgres, ruby-pg etc.. all give me this error.

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

/usr/bin/ruby1.9.1 extconf.rb
extconf.rb:4:in `<main>': uninitialized constant PLATFORM (NameError)


Gem files will remain installed in /var/lib/gems/1.9.1/gems/postgres-0.7.9.2008.01.28 for inspection.
Results logged to /var/lib/gems/1.9.1/gems/postgres-0.7.9.2008.01.28/ext/gem_make.out

What do I need to have installed so they build properly?

[]'s
Rodrigo Dellacqua

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonra...@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-ta...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.




adrianb

unread,
Jan 10, 2010, 10:35:22 PM1/10/10
to Ruby on Rails: Talk


I'm up and running with the postgres gem with postgresql 8.3.5. If i
recall correctly it was a very quick and painless setup.

Rodrigo Dellacqua

unread,
Jan 10, 2010, 11:13:47 PM1/10/10
to rubyonra...@googlegroups.com
It seems that I'm lacking some dev libraries that Im not aware of.

Anyone knows?

[]'s
Rodrigo Dellacqua

adrianb

unread,
Jan 11, 2010, 1:39:50 AM1/11/10
to Ruby on Rails: Talk

On Jan 11, 12:13 pm, Rodrigo Dellacqua <rgoyta...@gmail.com> wrote:
> It seems that I'm lacking some dev libraries that Im not aware of.
>
> Anyone knows?
>

Perhaps the development packages for postgresql?

Phillip Koebbe

unread,
Jan 10, 2010, 5:54:32 PM1/10/10
to Ruby on Rails: Talk

Hi Rodrigo

I'm using PostgreSQL 8.3.x and the pg gem.

Peace,
Phillip

Rodrigo Dellacqua

unread,
Jan 11, 2010, 9:27:03 AM1/11/10
to rubyonra...@googlegroups.com
Hey there,

Thanks for all the answers so far, it seems that there are 3 gems currently working, pg, postgres, ruby-pg.

But I can't get it to build, does anyone knows which libs I need to have installed? or where to check that?

I currently have postgres-8.4-dev

[]s
Rodrigo Dellacqua

Peter

unread,
Jan 11, 2010, 11:45:21 AM1/11/10
to Ruby on Rails: Talk
This is generally confusing but here's what I think you should do:
1) Remove postgres and ruby-pg gems if they are installed; the
correct, current one is pg which should be at version 0.8.0 (assuming
you're on linux, this all might change on windows).
2) The library packages you're missing is most likely libpq-dev (on
ubuntu sudo apt-get install libpq-dev, not sure about other distros);
in addition i'd try adding in build-essential if you don't have it, as
well as ruby1.8-dev.
3) After that try doing a gem install pg; if that fails the error
message tells you where the error log is for the build, posting that
would help identify what is missing.

Good luck

\Peter

On Jan 11, 8:27 am, Rodrigo Dellacqua <rgoyta...@gmail.com> wrote:
> Hey there,
>

> Thanks for all the answers so far, it seems that there are 3 gems currently
> working, pg, postgres, ruby-pg.
>
> But I can't get it to build, does anyone knows which libs I need to have
> installed? or where to check that?
>
> I currently have postgres-8.4-dev
>
> []s
> Rodrigo Dellacqua
>

> On Sun, Jan 10, 2010 at 7:54 PM, Phillip Koebbe <phillipkoe...@gmail.com>wrote:
>
> > On Jan 10, 3:55 pm, Rodrigo Dellacqua <rgoyta...@gmail.com> wrote:
> > > Hey there,
>
> > > I'm trying to get started with RoR with Postgresql.
>
> > > I've been trying to find some information on it, but there's a lot of
> > really
> > > OLD info on that subject!
>
> > > What should I do to get my application working with Postgresql?
>
> > > I get an error while trying to install the gem.
>
> > > After reading i thought many info about alot of different gems.
>
> > > Which one is the right one?
>
> > Hi Rodrigo
>
> > I'm using PostgreSQL 8.3.x and the pg gem.
>
> > Peace,
> > Phillip
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Ruby on Rails: Talk" group.
> > To post to this group, send email to rubyonra...@googlegroups.com.
> > To unsubscribe from this group, send email to

> > rubyonrails-ta...@googlegroups.com<rubyonrails-talk%2Bunsu...@googlegroups.com>

Marnen Laibow-Koser

unread,
Jan 11, 2010, 11:58:48 AM1/11/10
to rubyonra...@googlegroups.com
Rodrigo Dellacqua wrote:
> Hey there,
>
> Thanks for all the answers so far, it seems that there are 3 gems
> currently
> working, pg, postgres, ruby-pg.
>
> But I can't get it to build, does anyone knows which libs I need to have
> installed? or where to check that?
>
> I currently have postgres-8.4-dev

I think you may need libpq. Check the gem docs.

>
> []s

LaughingNinja

unread,
Jan 11, 2010, 1:15:14 PM1/11/10
to Ruby on Rails: Talk
Hi, Rodrigo:

What's your error? What environment are you running under?

We have it working fine with a PostgreSQL dbase.I believe the gem is:
pg(0.8.0).

Thanks,

Gary.

Curtis Schofield

unread,
Jan 11, 2010, 1:40:50 PM1/11/10
to rubyonra...@googlegroups.com
Hey Rodrigo and All.

 I'm on OS X and it's not easy to get going out of the box - IIRC i usually have an issue with a postgres gem when I use ports.
I'm looking into it now.

What platform are you working on Rodrigo?


--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonra...@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-ta...@googlegroups.com.

Marnen Laibow-Koser

unread,
Jan 11, 2010, 1:46:30 PM1/11/10
to rubyonra...@googlegroups.com
Curtis Schofield wrote:
> Hey Rodrigo and All.
>
> I'm on OS X and it's not easy to get going out of the box

Actually it's quite easy. Install PostgreSQL, install headers (perhaps
through Fink), install gem. Done.

> - IIRC i
> usually
> have an issue with a postgres gem when I use ports.

So don't use ports!

> I'm looking into it now.
>
> What platform are you working on Rodrigo?

Best,

Curtis Schofield

unread,
Jan 11, 2010, 2:07:46 PM1/11/10
to rubyonra...@googlegroups.com
I'm glad it was easy for you.

> - IIRC i
> usually
> have an issue with a postgres gem when I use ports.

So don't use ports!


 Thanks for your suggestion - I'm not in the habit of throwing something out when with some patience
I can learn something new.

For anyone else who's had trouble with macports here is a walk through.

http://robotarmyma.de/post/329089358/postgresql-gem-pg-macmin-x86-64bit-macports

Big thanks to the note
http://www.icoretech.org/2009/08/how-to-install-pg-postgresql-gem-on-snow-leopard-64-bit/




Marnen Laibow-Koser

unread,
Jan 11, 2010, 4:28:48 PM1/11/10
to rubyonra...@googlegroups.com
Curtis Schofield wrote:
> I'm glad it was easy for you.
>
>> - IIRC i
>> > usually
>> > have an issue with a postgres gem when I use ports.
>>
>> So don't use ports!
>>
>>
> Thanks for your suggestion - I'm not in the habit of throwing something
> out
> when with some patience
> I can learn something new.

Agreed, but there's also no sense in using the wrong tool for the job.

Best,

Curtis Schofield

unread,
Jan 11, 2010, 4:46:27 PM1/11/10
to rubyonra...@googlegroups.com
On Mon, Jan 11, 2010 at 2:28 PM, Marnen Laibow-Koser <li...@ruby-forum.com> wrote:
Curtis Schofield wrote:
> I'm glad it was easy for you.
>
>> - IIRC i
>> > usually
>> > have an issue with a postgres gem when I use ports.
>>
>> So don't use ports!
>>
>>
>  Thanks for your suggestion - I'm not in the habit of throwing something
> out
> when with some patience
> I can learn something new.

Agreed, but there's also no sense in using the wrong tool for the job.

 
 Well be both can agree on that. I know from a long history of using software that packages like fink or macports often have bugs and occasionally we encounter them. After all, we programmers are human and make mistakes.

 

Rodrigo Dellacqua

unread,
Jan 11, 2010, 5:30:11 PM1/11/10
to rubyonra...@googlegroups.com
Hey guys, thanks for all the help on this.

k lets divide to conquer.

My Environment:

Ubuntu 9.10
Ruby1.9.1
Postgres 8.4

I have build-essential, libpq-dev and all that already installed.

The error was preventing me from installing the postgres or ruby-pg gems.

Now that you mentioned, I had already uninstalled everything and I tried installing the pg gem.

Well, odly enough it worked. But I still get an error while trying to install postgres or ruby-pg, but pg will do for me.

Thx guys.

[]'s
Rodrigo Dellacqua
Reply all
Reply to author
Forward
0 new messages