Fixing Autotest on my Macbook

In building my rails stack on my new black macbook, I managed to disable my “autotest”. Hitting “autotest -rails” from my app’s root directory spewed forth a litany of warnings, culminating in a fatal error.

$ autotest -rails
loading rails_autotest
[ various and sundry warning messages ]
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:
in `gem_original_require': 
no such file to load -- osx/cocoa (LoadError)

I did not have rubycocoa properly installed – I had used the .dmg file for this installation, but should not have.

If you’ve compiled ruby (as I did, using the instructions found in Dan Benjamin’s canonical mac osx rails configuration article on hivelogic.com), you must also configure and install rubycocoa from the command line. However, when I tried that, it failed too. It seems I did not include the “—enabled-shared” option when I originally installed ruby.

So, backtracking even further, I reinstalled ruby 1.8.6 from the .gzip on ruby-lang.org...

$ cd ruby-1.8.6
$ ./configure --prefix=/usr/local --enable-pthread \
--with-readline-dir=/usr/local --enable-shared
$ make
$ sudo make install
$ sudo make install-doc
$ cd ..

After successfully completing the ruby reinstall, I plowed back into rubycocoa, this time with much better results.

$ cd rubycocoa-0.10.1
$ ruby install.rb config --prefix=/usr/local/
$ ruby install.rb setup
$ sudo ruby install.rb install

Upon return to my application, autotest swept through my unit, functional and integration tests, returning to me a favorable growl message and an edifying green line...


About this entry