MacRuby and (too) persistent objects

If you’re starting with MacRuby and Xcode, you might stumble upon the same problem I did: If you deploy the project even once, those precompiled ruby object files (.rbo) stick to the deployment directory and you have to clean it up each time before testing any new code.

Here’s a simple script you can put in your non-deployment target, just click Add Build Phase (+) / Add Run Script and copy/paste the following code:

cd $CONFIGURATION_BUILD_DIR/$CONTENTS_FOLDER_PATH/Resources
for a in `find . -name "*.rbo"`; do rm -f $a; done

This isn’t pretty, but does the trick.

Also, you will probably want to go ahead and disable gdb for the development target. There’s no use in observing the ruby binary in case of its errors. Disabling gdb speeds up the launch of ruby tenfold.

Leave a Reply


*

This site uses Akismet to reduce spam. Learn how your comment data is processed.