Ruby Weekly is a weekly newsletter covering the latest Ruby and Rails news.

The Ultimate List of RubyCocoa Tutorials, Tips and Tools

By Peter Cooper / February 6, 2008

rubycocoa.png

RubyCocoa is a Ruby library and Mac OS X framework that bridges the Ruby programming language to the delights of Objective C and, more precisely, Cocoa, Apple's primary OS X application development framework. Included with Mac OS X Leopard (10.5.x), but also available to install for Tiger, RubyCocoa makes it easy to develop Ruby applications that take full advantage of what OS X's internal frameworks and libraries have to offer, whether it's building a regular GUI application or interacting with low level elements of OS X.

This post rounds up a lot of RubyCocoa-focused resources, tutorials, and other links, so that if you're new to RubyCocoa and just want to "dive in," a lot of the pages you'll want to visit are organized here. Enjoy!

Introduction

Official RubyCocoa Homepage - News and official information about RubyCocoa, including how to get started, links to documentation and a few code snippets.

List of Projects using RubyCocoa - Just what it says, a list of projects using the RubyCocoa library! Some of them come with source so could be worth checking out.

5 Things to Get Started with RubyCocoa - Chris Schmitt outlines five things you should do in order to get up to speed with RubyCocoa.

Using Scripting Languages for Cocoa Development - A brief, but well put, overview from Apple of using languages such as Ruby to develop Cocoa applications.

Tutorials

Your First Few Days on RubyCocoa - Slightly old (mid 2007) but this tutorial demonstrates how to put together a bare-bones OS X GUI application using RubyCocoa and XCode's Interface Builder. Tiger users might find this useful as it covers installation on that version of OS X.

RubyCocoa Tutorial - Eric Smith has put together a great, well illustrated, tutorial that walks you through from start to finish in building a currency conversion application (as Apple likes to use in their own Cocoa tutorial) with Ruby and Xcode.

NEW! Bowled Over By Cocoa - A newer, more up to date (as of April 2008) tutorial by Eric Smith that demonstrates how to create a Mac application using RubyCocoa, XCode and RSpec!

Japanese RubyCocoa Tutorial - It's in a RubyCocoa tutorial in Japanese but it's immaculately illustrated so shouldn't be dismissed out of hand. It seems to focus more on using Xcode than other tutorials.

Using Scripting Bridge in RubyCocoa Code - A tutorial from Apple that looks at how Ruby can interface with OS X applications through Scripting Bridge.

Using RubyOSA - A tutorial from Apple demonstrating how to use AppleScript-like scripting techniques in Ruby to interface with OS X applications. This is not directly related to RubyCocoa but provides an alternative to the Scripting Bridge approach.

rubyrocks.jpg

Ruby Rocks: Build A Whole Game With RubyCocoa! - A really interesting tutorial that walks you through the process of building an entire Asteroids-esque game using RubyCocoa (note: rubycocoa.com occasionally gives 404 errors accidentally, just refresh)

Writing Ruby Extensions with RubyCocoa - Tim Burks looks at how you can build Ruby extensions with C wrapped in Objective-C classes using RubyCocoa. Considering OS X's fine support for gcc (and therefore RubyInline) I'm not entirely sure how useful this is.

An O'Reilly Introduction to RubyCocoa - A very old RubyCocoa tutorial from 2004 (!!) that is mostly out of date but does provide a good overview. Don't put this at the top of your reading list though. For RubyCocoa junkies only.

Specific Tasks and Tricks

Simple Wireless Signal Strength Meter - Sandro Paganotti demonstrates how to read information about your wireless signal on OS X. Curiously, this doesn't use RubyCocoa for the main task, but for playing a sound instead.

Using Your Apple Remote from Ruby - A demonstration of how to use RubyCocoa to interface with the Apple Remote (well, pick up its requests, at least!)

OutlineMe.png

Outline Views with RubyCocoa - Tim Perrett provides code for producing a tree / outline-type view on OS X using Ruby.

attachment_fu magic with Core Image and RubyCocoa - A tutorial that demonstrates how to use RubyCocoa and OS X's Core Image library to perform graphical operations on files uploaded through the attachment_fu plugin.

line_theme_keynote_.png

Cocoa Magic for Gruff Graphs - Using RubyCocoa and the Gruff charting library to produce graphs without relying on installing ImageMagick!

RubySaver - It's in Japanese, but it seems to be demonstrating how to create a screen saver using Ruby and RubyCocoa, specifically one that shows information from Wikipedia?

Interfacing with Skype - In Japanese again, but a demonstration of how to hook up with Skype from Ruby, specifically to set your status text to your currently playing iTunes track.

Screen Capture with RubyCocoa - A walk through developing a small Ruby application to take screenshots.

Cool Image Effects with Core Image - A great look at how to use Core Image's graphics effects from Ruby code. Lots of pictures and code examples. RMagick is history!

Text to Speech App - A quick code demonstration of how to get your Mac saying things to you from Ruby.

Control iTunes from Ruby - A code snippet showing how to use ScriptingBridge to control iTunes and get back the name of the current track.

selectable-toolbar.png

Selectable Toolbar Icons in RubyCocoa and Animating NSViews in RubyCocoa - Matt McCray demonstrates how to create a funky, animated GUI preferences panel using Ruby.

Write a QuickSilver Plugin with RubyCocoa - How to use Objective C and Ruby to build a plugin for the QuickSilver launcher / general purpose tool.

Ruby and FSEvents - Info about a Ruby app called fswatch that can use OS X's File System Events framework to monitor what occurs on the file system.

pierliscaptcha.png

CAPTCHA Creator - A blog post outlining how a CAPTCHA generator was built using Ruby and RubyCocoa (along with Quartz Composer). A ZIP of the full source code is also available.

Tools and Libraries

RubyInject - RubyInject provides a mechanism to 'inject' a Ruby interpreter into any running OS X application. This can provide you with the ability to mess around with OS X applications on the fly from an irb-esque prompt.

Rucola - Rucola is a framework that makes it easier to build Cocoa applications using Ruby and RubyCocoa. Essentially it provides a set of generators that can generate controllers, window controllers, and document-based applications. A bit like a "Rails" for Cocoa, but, erm, not.

platypus_screenshot.jpg

Platypus - Not specifically related to RubyCocoa, Platypus is an OS X application that can "package up" Ruby applications for easier distribution. This could make distributing your RubyCocoa creations a lot easier and give other users a seamless installation experience.

Capture - A Gem-installable (gem install capture) OS X screenshot tool.

NewCocoa - A Rails-like command for building RubyCocoa apps. A little like Rucola (above). This post features a screencast of its use.

Miscellaneous

default3col.png

LimeChat - An IRC client written in Ruby and using RubyCocoa. Comes with source code!

RubyCocoa Tips - Building RubyCocoa Projects with Rake, debugging RubyCocoa problems with gdb, converting Objective-C Cocoa apps into Ruby, and dealing with special Cocoa data types in Ruby.

pong.png

/Developer/Examples/Ruby/RubyCocoa - Not a Web-accessible URL, just a folder on your system (if running Leopard) that contains a whole bunch of Apple-developed RubyCocoa examples! There's even a Pong game.

Rewriting Ruby's classes in Objective C? - Laurent Sansonetti talks about an interesting project to migrate chunks of Ruby over to Objective C.

Code74 - An OS X Webkit-powered Web browser written in Ruby.

Objective C, Ruby and Python for Cocoa - A well written discussion of the cultural and technical aspects involved in writing Cocoa applications with various languages.

LogEye - a Rails log-file GUI - An OS X RubyCocoa app that can view your Rails log files with coloring, etc.

Tips and Pitfalls - A list of tips and pitfalls to using RubyCocoa from the perspective of one developer.

Many thanks to this curious Japanese list of RubyCocoa links for inspiring some of the links in this post. Most of them are in Japanese, however!

Comments

  1. Mirko says:

    Nice collection of RubyCocoa tutorials! Thanks for putting this list together. I've been planning to play with RubyCocoa, so this should come in handy.

  2. Chris says:

    Superb list, Mr. Cooper. Thank you.

  3. Peter Cooper says:

    @Chris: Thanks! I have been meaning to post about Ambition lately, especially since it "opened up" somewhat.. but I'm struggling to find a way to succinctly get over how awesome it is and do it justice. Anyway, I think it could be a game changer in the future, and hope to get to it!

  4. Adam Conroy says:

    Echo to the above praise, this will help me a lot.

  5. ma_ko says:

    Nice list. Many thanks, too:-)
    # A writer of Japanese list of RubyCocoa links

  6. Alex says:

    Wow, great list! And for the Windows users, any interesting API with mega list like that in the future ??

  7. c0ld_ says:

    Nice, thats a good list.

    I was wondering if you have any more good links to Japanese tutorials. As a CS student who speaks Japanese, part of the draw to Ruby is the opportunity to try branching out my technical skills in my second language.

Other Posts to Enjoy

Twitter Mentions