Erik's Engineering

something alliterative

ruby-serialport, ruby 1.9.1

Setting up my new laptop (running Snow Leopard), I thought I'd go the snazy route and use the latest versions of everything. Ruby 1.9.1, Postgres 8.4. Once I get everything running with that, I'll try porting data_logger to rails 3.

First hitch: the pg gem did not want to compile with ruby 1.9.1. This may have been complicated by an attempt to switch to doing everything in 64 bit mode. The Postgres 8.4 binaries are 32 bit only. The latest Xcode really wants to compile ruby as 64 bit, even when running with a 32 bit kernel. Life will be easier if you compile ruby with CFLAGS='-arch i386' and LDFLAGS='-arch i386'. You'll probably also want to use the cutting edge version of ruby-pg from bitbucket. 0.9.0 hasn't been officially released, but it fixed my problems.

Second hitch: ruby-serialport looks to be indistinguishable from abandonware. No updates in > 1 year. It doesn't compile with ruby 1.9.1 and was using interfaces that were only included in 1.8.7 for backwards compatibility. I spent a bunch of time working on porting it, before finding this patch. I've got a patched version (with version number incremented) on my github. Just do:

git clone cd ruby-serialport rake compile sudo rake install

Now I can access my database and I/O boards from the laptop.

*** update ***

As soon as I went to report success on ruby-serialport at, I noticed... there's now a 'serialport' gem, that is maintained and works with 1.9. Grab it. Forget about ruby-serialport :)

Published on 07/02/2010 at 00h43 under . Tags ,

Comment ruby-serialport, ruby 1.9.1

Trackbacks are disabled

Powered by Typo – Thème Frédéric de Villamil | Photo Glenn