Currently Google SketchUp for Mac has Ruby version
1.8.5 which I find a bit outdated. I can update Ruby to 1.8.7 (OSX's version) by the following commands
$ cd /Applications/Google\ SketchUp\ 7/SketchUp.app/Contents/Frameworks/Ruby.framework/Versions/Current $ ls Headers/ Resources/ Ruby $ ls Headers/ config.h defines.h intern.h missing.h ruby.h $ rm -r Headers $ ln -s /System/Library/Frameworks/Ruby.framework/Headers $ ln -fs /System/Library/Frameworks/Ruby.framework/Ruby
SketchUp starts without problem and Ruby console shows version 1.8.7.
Now I try to go further and update to
1.9.2-rc2. Google SketchUp requires
i386 binary, which can be produced by the following commands
$ cd ~/ruby-1.9.2-rc2/ $ ARCHFLAGS="-arch i386" CFLAGS="-arch i386" LDFLAGS="-arch i386" ./configure --with-arch=i386 $ make && sudo make install
Then I copy necessary files to SketchUp
$ cd /Applications/Google\ SketchUp\ 7/SketchUp.app/Contents/Frameworks/Ruby.framework/ $ rm Headers Ruby $ cp /usr/local/bin/ruby Ruby $ mkdir Headers $ cp /usr/local/include/ruby-1.9.1/i386-darwin10.4.0/ruby/config.h Headers/ $ cp /usr/local/include/ruby-1.9.1/ruby.h Headers/ $ cp -r /usr/local/include/ruby-1.9.1/ruby/* Headers/ $ ls Headers backward/ defines.h dl.h intern.h missing.h re.h ruby.h util.h vm.h config.h digest.h encoding.h io.h oniguruma.h regex.h st.h version.h
and when I try to start SketchUp I get the following error report
Exception Type: EXC_BREAKPOINT (SIGTRAP) Dyld Error Message: Library not loaded: @executable_path/../Frameworks/Ruby.framework/Versions/A/Ruby Referenced from: /Applications/Google SketchUp 7/SketchUp.app/Contents/MacOS/SketchUp Reason: no suitable image found. Did find: /Applications/Google SketchUp 7/SketchUp.app/Contents/MacOS/../Frameworks/Ruby.framework/Versions/A/Ruby: can't map /Applications/Google SketchUp 7/SketchUp.app/Contents/MacOS/../Frameworks/Ruby.framework/Versions/A/Ruby: can't map /usr/local/lib/Ruby: not a file /usr/lib/Ruby: not a file Model: MacBookPro7,1, BootROM MBP71.0039.B05, 2 processors, Intel Core 2 Duo, 2.4 GHz, 4 GB, SMC 1.62f5
Could you tell me why?
Dan Rathbun made some tests and found the following
On Win32 when I tried to get Sketchup to load any 1.9.x I got an "Entry point not found" for the ruby C function "rb_set_kcode" which is no longer in 1.9.x (it was renamed, and the Ruby people did not alias the old name to the new name.)
Basically Sketchup calls rb_set_kcode to set the character encoding to UTF8 just after loading the Ruby interpreter. It works fine for any Ruby in the 1.8.x branch, but in 1.9.x the Ruby project totally reengineered the character encoding, and gave all the C functions new identifiers, and added alot more functions.
The solution for 1.9.x and Sketchup seems to be that Sketchup needs to be "Ruby Version Agile", which means a coding change by the Google Guys in Boulder.