If you’re upgrading to Snow Leopard and develop with Ruby on Rails you’ll need to do a few things.

First, a note about Java. If you depend on Java, 10.6 no longer has Java 1.5. The current workaround for this is to copy a 1.5 install from a non-snow-leopard mac. More instructions here (there’s a d/l for 1.5 as well; yes, Snow Leopard DELETIFIES 1.5).

1) Install XCode from the CD (required for ruby headers)
1a) Install iPhone SDK if that’s something you do
2) gem uninstall ruby-debug-base; gem install ruby-debug-base linecache
3) rebuild database gems and/or drivers (you’ll likely need arch flag, below)

I can’t speak for others but for PostgreSQL I had 8.3 installed and had to download/compile/install the latest 8.3.7 from source then gem uninstall dbd-pg, pg, and ruby-pg and reinstall them – prefixing gem install with ARCHFLAGS=”-arch x86_64″.

For our particular project I had to reinstall json, nokogiri, and rjb (had to export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0 ).

If you use mod_passenger, reinstall and follow install instructions (passenger-install-apache2-module).

Shameless plug: if this helped you, you live in Texas, and drive < 12k miles a year, checkout my employer.

Errors this stuff fixed for me:

/path/to/gems/ruby-debug-base-0.10.3/lib/ruby_debug.bundle: dlopen(/path/to/gems/ruby-debug-base-0.10.3/lib/ruby_debug.bundle, 9): no suitable image found.  Did find: (LoadError)
	/path/to/gems/ruby-debug-base-0.10.3/lib/ruby_debug.bundle: no matching architecture in universal wrapper - /path/to/gems/ruby-debug-base-0.10.3/lib/ruby_debug.bundle

/path/to/gems/linecache-0.43/lib/../lib/trace_nums.bundle: dlopen(/path/to/gems/linecache-0.43/lib/../lib/trace_nums.bundle, 9): no suitable image found.  Did find: (LoadError)
	/path/to/gems/linecache-0.43/lib/../lib/trace_nums.bundle: no matching architecture in universal wrapper - /path/to/gems/linecache-0.43/lib/../lib/trace_nums.bundle

/path/to/gems/activerecord-2.3.3/lib/active_record/connection_adapters/abstract/connection_specification.rb:76:in `establish_connection': Please install the postgresql adapter: `gem install activerecord-postgresql-adapter` (dlopen(/path/to/gems/pg-0.8.0/lib/pg.bundle, 9): no suitable image found.  Did find: (RuntimeError)
	/path/to/gems/pg-0.8.0/lib/pg.bundle: no matching architecture in universal wrapper - /path/to/gems/pg-0.8.0/lib/pg.bundle)

# This happens when postgresql is old. I had to compile 8.3.7 from source with archflags above.
compat.h:38:2: error: #error PostgreSQL client version too old, requires 7.3 or later.

dlopen(/path/to/gems/json-1.1.7/ext/json/ext/generator.bundle, 9): no suitable image found.  Did find:
	/path/to/gems/json-1.1.7/ext/json/ext/generator.bundle: no matching architecture in universal wrapper - /path/to/gems/json-1.1.7/ext/json/ext/generator.bundle

dlopen(/path/to/gems/nokogiri-1.3.2/lib/nokogiri/nokogiri.bundle, 9): no suitable image found.  Did find:
	/path/to/gems/nokogiri-1.3.2/lib/nokogiri/nokogiri.bundle: mach-o, but wrong architecture - /path/to/gems/nokogiri-1.3.2/lib/nokogiri/nokogiri.bundle

dlopen(/path/to/gems/rjb-1.1.7/lib/rjbcore.bundle, 9): no suitable image found.  Did find: (LoadError)
	/path/to/gems/rjb-1.1.7/lib/rjbcore.bundle: no matching architecture in universal wrapper - /path/to/gems/rjb-1.1.7/lib/rjbcore.bundle

# Java stuff spits out something like this
:in `load': can't create Java VM (RuntimeError)
/Users/alexl/code/gems/gems/ruby-debug-base-0.10.3/lib/ruby_debug.bundle: dlopen(/Users/alexl/code/gems/gems/ruby-debug-base-0.10.3/lib/ruby_debug.bundle, 9): no suitable image found.  Did find: (LoadError)
/Users/alexl/code/gems/gems/ruby-debug-base-0.10.3/lib/ruby_debug.bundle: no matching architecture in universal wrapper – /Users/alexl/code/gems/gems/ruby-debug-base-0.10.3/lib/ruby_debug.bundle

4 Responses to “Snow Leopard – Rails; Java stink”

  1. Jake Says:

    You just made my day. I was having the hardest time trying to figure out why I couldn’t get my pg gem to work.

  2. KendallB Says:

    Thanks, it worked wonderfully for RJB. Just for anyone else, you’ve got to follow the instructions at the very top by installing the old Leopard installation of Java. I tried by simply changing JAVA_HOME, but it doesn’t work without first installing the old Java.

  3. Alex Says:

    Cheers, mate

  4. John Sawers Says:

    Thanks!
    I hadn’t tried to debug since the SL update, so I never would have pegged that as the cause.


Leave a Reply