Snow Leopard and ruby-serialport
September 06, 2009 | 1 Minute Read
A s soon as I upgraded to Snow Leopard, my mastery of the hardware serial port looked decidedly unhealthy:
peter@McMullen ~/Documents/saphum $ irb -r ifos/ifos.rb
/Library/Ruby/Gems/1.8/gems/ruby-serialport-0.7.0/lib/serialport.bundle: dlopen( /Library/Ruby/Gems/1.8/gems/ruby-serialport-0.7.0/lib/serialport.bundle, 9) : no suitable image found. Did find: ( LoadError)
/Library/Ruby/Gems/1.8/gems/ruby-serialport-0.7.0/lib/serialport.bundle: no matching architecture in universal wrapper - /Library/Ruby/Gems/1.8/gems/ruby-serialport-0.7.0/lib/serialport.bundle
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in ` require'
from /Library/Ruby/Gems/1.8/gems/ruby-serialport-0.7.0/lib/serialport.rb:1
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:36:in ` require'
from ../modbus/modbus.rb:25
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in ` require'
from ./ifos.rb:19
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in ` require'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/irb/init.rb:253:in `load_modules'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/irb/init.rb:251:in ` each'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/irb/init.rb:251:in `load_modules'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/irb/init.rb:21:in ` setup'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/irb.rb:54:in `start'
from /usr/bin/irb:13
Thanks to Matt Aimonetti for a timely explanation of why certain Ruby extensions might suddenly stop working after the upgrade. (Short version: they’re compiled for 32-bit; Snow Leopard runs 64-bit by default.) He even provided a script (sl_gems_update.rb ) to identify other gems that might be affected. In my case, ruby-serialport was the only one:
peter@McMullen ~/Documents/saphum $ ./sl_gems_update.rb
looking for the gems to upgrade...
***
Please reinstall:
ruby-serialport versions: 0.7.0, 0.7.0
or uninstall all gems that need to be reinstalled:
$ sudo gem uninstall ruby-serialport
and reinstall them:
$ sudo gem install ruby-serialport
peter@McMullen ~/Documents/saphum $ sudo gem uninstall ruby-serialport
Successfully uninstalled ruby-serialport-0.7.0
peter@McMullen ~/Documents/saphum $ sudo gem install ruby-serialport
Building native extensions. This could take a while ...
Successfully installed ruby-serialport-0.7.0
1 gem installed
Installing ri documentation for ruby-serialport-0.7.0...
Installing RDoc documentation for ruby-serialport-0.7.0...
peter@McMullen ~/Documents/saphum $