Search
Tweets
Recent Changes
« Catching Up | Main | Selfish People Suck »
Tuesday
Oct042005

Ruby On Rails and Ruby-Postgres on Mac OS X Tiger

I try to like you, I really do. I want to use your phenomenal cosmic power to make my life easier. Disclaimer: I'm on OS X w/the default 1.8.2 install.

Today, I installed Rails and said: "During lunch, I'm gonna start porting my app to Ruby On Rails!" I already have Postgres installed, and gem quickly made short work of the Rails installation. Then came the violent end: ruby-postgres. gem can't find it. I download it and run 'ruby extconf.rb' per instructions. (What's up with every ruby thing I install having a different installation?) No errors, but make says there's no Makefile. A quick ls proves that make is correct. I run 'ruby extconf.rb' again. Still no errors. Viewing the source for extconf.rb shows this:


if(have_func("socket") or have_func("cygwin32_socket")
...all the important stuff...

Silly goose, you can't find my socket()! Hrm... It's there. Comes from sys/socket.h. I wish I had a clue how to tell mkmf that. I find it very rude that this thing just dies quietly when it can't find socket().

So here I am, staring at a bunch of functions for mkmf. I'm schooled in autoconf, but I despise having to figure something like this out. It makes me savor using Java's uber-complicated 'drop a jar into a directory' system.

It just got worse. I find there is a mkmf.log file generated, and looking at it, the linker is trying to find "-lruby-static". WTF is that? This explains why it can't find socket(). At least I learned about mkmf... A quick search for this nefarious ruby-static library yields nothing.

UPDATE: sudo gem install fixrbconfig; fixrbconfig; Now it just fails, saying it can't find Postgres. That's something I can work with.

UPDATE: Adding -L/usr/local/pgsql/lib to the LDFLAGS and -I /usr/include/pgsql/include to CFLAGS fixed it. This could easily be avoided by adding --prefix=/usr at PostgreSQL's configure.

Reader Comments (1)

I'm really enjoying locomotive for handling the rails/postgresql/mysql install on os x. It's available at locomotive.sourceforge.net and won't interfere with your existing setup. You really want to give it a look.

October 4, 2005 | Unregistered Commenterjperkins

PostPost a New Comment

Enter your information below to add a new comment.

My response is on my own website »
Author Email (optional):
Author URL (optional):
Post:
 
Some HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>