Developing Xcode 4 Plugins

This is a quick guide that documents how to start developing plugins for Xcode4. You need to have Xcode installed to create plugins.

Step 1 – Xcode Plugin Project Template

  • Grab the Xcode project template for creating plugins from here
  • Create the plugin template folder ~/Library/Developer/Xcode/Templates/Project Templates/Application Plug-in/Xcode4 Plugin.xctemplate if it doesn’t already exist.
  • A quick way to do this is with the following command mkdir -p "~/Library/Developer/Xcode/Templates/Project Templates/Application Plug-in/Xcode4 Plugin.xctemplate"
  • Copy the contents of the GitHub repository to the folder you just created.
  • Restart Xcode.

Step 2 – Create a test project

  • Open Xcode, and select File > New > Project
  • Then under OS X > Templates tap Xcode4 Plugin (shown below)

Screen Shot 2013-04-29 at 3.44.05 PM

From the GitHub repo:

The default plugin file links against AppKit and Foundation, and, when built 
(and Xcode is restarted), creates a menu item labeled "Do Action" in the File menu. 
Pressing the menu item should open an alert. Customize at will!

If we run the project we just created, it will automatically build and copy the plugin to the right location. In this case it is ~/Library/Application Support/Developer/Shared/Xcode/Plug-ins/[Project Name].xcplugin. Restarting Xcode, we get a new menu item under the File menu!

Screen Shot 2013-04-29 at 3.53.02 PM

When we click on the menu item, we get an alert:

Screen Shot 2013-04-29 at 3.53.49 PM


  • Xcode plugins have to be written using Objective-C GC, this means you have to use retain and release calls in your code. (No ARC support).

Where to go from here?

  • This StackOverflow answer has some great ideas on where to go next.
  • You can get a dump of the private headers that Xcode uses by using the class-dump tool
  • brew install class-dump is the quickest way to get it if you have homebrew installed.
  • IDEKit and IDEFoundation are present at
  • DVTKit and DVTFoundation are present at
  • By registering an observer for nil you can see all the notifications that are being called. This is useful to find out which actions are called and when, and what notifications you might need to listen for.

Setting up Kinect on OSX the easy way

Open Terminal

Install homebrew with the following command

/usr/bin/ruby -e "$(curl -fsSL" 

Make sure homebrew is up to date with

sudo brew update

Change directory to your brew home folder with

cd /usr/local/Library/Formula
curl --insecure -O ""
curl --insecure -O ""

brew install libfreenect


GlView showing kinect depth view

Detaching a running process from a bash shell

When I run a command on a machine that I am ssh’ed into, most of the time I want to kill the connection but have the command continue to execute.

There are several ways to detach a process from the current shell:

The first is to start the process with:

nohup command &

However, I usually start a command and forget to detach it initially. An easy way to detach a currently running process from a shell is like this:

disown %1

These methods daemonise a running process and make the process ignore the SIGHUP command so that when you close you shell or ssh connection, the command continues to run. For more information check out the man pages for disown and nohup.

SideBySide video player

Often I find the need to play two videos side by side without borders or separate windows. Until now, I have been converting two videos into a single video which takes forever.

So I wrote a simple little cocoa OSX app to load up and play two videos side by side. It doesn’t have heaps of features, but it does exactly what I need so I am posting this incase anyone else could use it.

This application uses QTkit to play videos so the file size is tiny. (Only 57KB!)

Here’s a screenshot:

I used an icon set from in this application under the free license terms.

Download here:


Since I got my new laptop, I have been working on a personal project creating a simple, easily extendable raytracer.

I have got it working so far, but at the moment it doesn’t do too much. I have sphere and plane rendering working and saving to TGA images. The whole thing should look a lot better once I add anti-aliasing, shadows, reflections, refractions, shading and different types of objects. For now here is a picture showing what it can do at the moment. (Currently only orthogonal projection is supported). Not bad for a day and a half of work!

Two intersecting spheres

Doesn’t really look too great at the moment because the raytracer doesn’t support shading or perspective projection, but these should be added in the next couple of days.

I am really excited to be writing a raytracer, but I am going to have to force myself to have some time off at some point (because a ray tracer is never done!) to work on some other projects. This project has only been tested on OSX Snow Leopard but should be cross platform if the bitmap creation libraries are recompiled for a different platform. I may post code later at some point, but the image saving code is not mine and I will have to check the license conditions.

More updates to come soon.