Ruby in Leopard, the latest release of Mac OS X
Author: ceefour | Filed under: Apple Mac OS X, GUI, News, Rails, Ruby, Tips, ToolsNow that Leopard, the latest release of Mac OS X, is available to everyone, you may wonder what has changed from the Ruby developer’s perspective.
Ruby
Ruby in Leopard was framework’ized. It is now available in /System/Library/Frameworks/Ruby.framework. Compatibility with the previous directory layout is preserved, /usr/bin/ruby and /usr/lib/ruby
Let see the example symbolic links that point inside 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
IRB
Now that readline support is available, IRB has command-line editing and history support.
IRB was modified to look at /etc/irbrc as the last possible place for a configuration file. 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
RubyGems in Leopard uses two gems repositories:
$ ruby -r rubygems -e "p Gem.path" ["/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8", "/Library/Ruby/Gems/1.8"]In order to add a new gem to the /System repository, you will have to explicitly point the GEM_HOME environment variable to it. Please note that you can uninstall or cleanup old gems that are in the /System repository. The gem_server utility is not part of the client distribution of Leopard. It is only provided in the server.
DTrace
DTrace static probes were added in the interpreter engine. We actually took the amazing patches that the Joyent guys wrote for Solaris, and modified the code a little bit to make it work under Leopard and to address some small problems.
RubyCocoa and Bridge Support
This is an Objective-C to Ruby bridge, is now delivered with the system, in /System/Library/Frameworks/RubyCocoa.framework. The version that we ship is actually 99%-based on the public 0.12.0 release, module some Leopard-only specific changes, that will soon be pushed upstream.
Both RubyCocoa and the BridgeSupport files come with any Leopard installation. You can find some examples in /Developer/Examples/Ruby/RubyCocoa.
For more details visit Mac OS Forge.
No related posts.
Related posts brought to you by Yet Another Related Posts Plugin.