Ruby has been upgraded to 1.8.6p36, latest stable release before Apple deadline. Some patches have been merged , for important bugs discovered after p36.
Ruby in Leopard is available in /System/Library/Frameworks/Ruby.framework . Compatibilty is preserved with former layout : /usr/bin/ruby and /usr/lib/ruby are symbolic links pointing to the framework :
$ readlink /usr/bin/ruby ../../System/Library/Frameworks/Ruby.framework/Versions/Current/usr/bin/ruby $ readlink /usr/lib/ruby ../../System/Library/Frameworks/Ruby.framework/Versions/Current/usr/lib/ruby $ readlink /usr/lib/libruby.1.dylib
../../System/Library/Frameworks/Ruby.framework/Versions/Current/usr/lib/libruby.1.dylib
The Ruby libruby.1.dylib library, which contains the core of the interpreter, is available as a 4-way universal binary : ppc, i386, ppc64 and x86_64. The ruby interpreter launcher /usr/bin/ruby has been left 32bit not to break compatibility with scripts using Tk extension
Ruby C extensions will compile 2 ways ppc and i386 : use the ARCHFLAGS environment variable to configure the build of an extension :
$ ARCHFLAGS="-arch i386" ruby extconf.rb # Will build for Intel 32-bit only. $ make $ sudo make install
You can use the ARCHFLAGS to configure the architecture flag of a Gem build. Use a root shell (and not sudo, that doesn’t transfer environment variables to the privileged process)
Ruby libraries and extensions are installed in /Library/Ruby/Site/1.8 which is part of the default load path. You can install whatever you want without worrying about incidentally break things in /System.
IRB :
Now that readline is available, irb has command line editing and history support.
Leopard ships an /etc/irbrc file that provides a default configuration for all IRB sessions, that requires RubyGems, activates auto-completion, switches to the simple prompt, and sets up a permanent history facility.
If you have a custom IRB configuration file in your home directory, or supply one to IRB from the command line, /etc/irbrc will be ignored. IRB currently doesn’t support the load of multiple configuration files.
Gems
Rubygem 0.9.4 is available by default. Pre-installed gems are :
actionmailer (1.3.3) actionpack (1.13.3) actionwebservice (1.2.3) activerecord (1.15.3) activesupport (1.4.2) acts_as_ferret (0.4.1) capistrano (2.0.0) cgi_multipart_eof_fix (2.2) daemons (1.0.7) dnssd (0.6.0) fastthread (1.0) fcgi (0.8.7) ferret (0.11.4) gem_plugin (0.2.2) highline (1.2.9) hpricot (0.6) libxml-ruby (0.3.8.4) mongrel (1.0.1) needle (1.3.0) net-sftp (1.1.0) net-ssh (1.1.2) rails (1.2.3) rake (0.7.3) RedCloth (3.0.4) ruby-openid (1.1.4) ruby-yadis (0.3.4) rubynode (0.1.3) sources (0.0.1) sqlite3-ruby (1.2.1) termios (0.9.4)
DTrace
DTrace static probes were added in the interpreter engine.
The probes that you can register to are the following:
function-entry function-return gc-begin gc-end line object-create-done object-create-start object-free raise rescue ruby-probe
You can read more about the probes in the Joyent’s [ruby-dtrace project] page.
There are a couple of DTrace examples that use the DTrace probes in /Developer/Examples/Ruby/DTrace.
More information about RubyCocoa and BridgeSupport, XCode and InterfaceBuilder, Scripting Bridge on MacOS Forge.

