Snow Leopard, not completely Intel only

I initially started writing this while I was re-installing all the ruby gems that didn't work after the upgrade. So far, only the gems that build native extensions (eg. mysql, thin, eventmachine, etc..) needed to be re-installed. Then I somehow got off track and started digging around and found the things below.
Mac OS X 10.6 aka Snow Leopard comes bundled with Ruby 1.8.7p72. It also comes with Rails 2.2.2 and Rails 1.2.6. Why Apple included Rails 1.2.6 is a mystery.

With Snow Leopard supposedly being full of 64 bit goodness, I was surprised to find out that the ruby executable Universal Binary contains ppc architecture. Here is the output from the file command
$ file /usr/bin/ruby
/usr/bin/ruby: Mach-O universal binary with 3 architectures
/usr/bin/ruby (for architecture x86_64): Mach-O 64-bit executable x86_64
/usr/bin/ruby (for architecture i386): Mach-O executable i386
/usr/bin/ruby (for architecture ppc7400): Mach-O executable ppc

and the lipo command shows this
$ lipo -info ruby
Architectures in the fat file: ruby are: x86_64 i386 ppc7400

Most of the executables in /usr/bin and /usr/sbin are Universal Binaries. A few of the binaries are i386 ppc7400 and an even smaller number are i386 only.
It seems that the default apps only contain the i386 and x86_64 architectures. Even the kernel is a Universal Binary.
$ lipo -info mach_kernel
Architectures in the fat file: mach_kernel are: x86_64 i386 ppc
The mach kernel on my G5 with 10.5.8 is a little over 9mb with the i386 and ppc architecture, the 10.6 kernel is 18mb and contains x86_64, i386 and ppc architectures. I can understand the need for i386 for some of the early Intel Macs, but why include the PPC architecture if Snow Leopard is going to be for Intel Macs only.

NOTE: The output from these commands were produced on a machine with a clean Snow Leopard install

Posted by tommy Sat, 29 Aug 2009 20:50:46 GMT


Ruby 1.9 on Mac OS X

UPDATE: use this instead Ruby Version Manager

Quick steps for installing Ruby 1.9.1 while preserving the existing ruby installation.

Things to know before following these directions:

  • I don’t use MacPorts or Fink. There is nothing wrong with using either of them, I just prefer not to.
  • I’m doing this on an Intel Mac running Mac OS X 10.5.7, no guarantees for any other
  • architecture or OS X version
  • i use ~/source for most of my development work.
  • I wrote this for some of my less system minded co-workers
Open a terminal window and type the following commands

Install GNU Readline. Skip this step if you already have readline installed. You may also use Fink or MacPorts to install.

  • tar xvzf readline-6.0.tar.gz
  • cd readline-6.0
  • ./configure
  • make
  • sudo make install
  • Install Ruby 1.9.1:
Create an alias for using the new ruby:
  • cd ~
  • vim .bash_profile
  • add this line: alias ruby-19=’export PATH=/opt/ruby/bin:$PATH’
  • save the file and exit vim
You can either exit the terminal and restart it or type source ~/.bash_profile to enable the new alias.To start using the new ruby, just type ruby-19

Install notes for some common gems:

  • enter ruby -v to make sure you’re using the correct version of ruby. It should report version
  • 1.9.1p203, if not, enter the ruby-19 command created above.
  • MySQL - install hectoregm-mysql-ruby. The mysql gem doesn’t work on Ruby 1.9
  • rspec and rspec-rails. You need to also install test-unit v1.2.3 for rspec-rails to work properly.
  • Make sure that v1.2.3 is the only one installed. If you also have a newer version installed, things 
won’t work.
  • mongrel - needs to be patched using these directions http://isitruby19.com/mongrel . If you 
followed my directions, change the path in step 1 to /opt/ruby19/lib/ruby/gems/1.9.1/gems/mongrel-1.1.5/ext/http11
  • mongrel_cluster
  • check http://isitruby19.com for other gems

Posted by tommy Fri, 26 Jun 2009 07:32:00 GMT