Building a 64-bit prefpane

Configuring Xcode to build for 64 instead of 32-bit architectures.

The System Preferences application on Mac is universal since Snow Leopard: it can run in 32-bit or 64-bit but not at the same time. That’s why you must restart the application when you want to open an older Preference Pane.

Today I tried to upgrade the LazyPoken prefpane as it was still a 32-bit build and the next Mac OS X will probably no longer support the 32-bit System Preferences application. That turned out to be a little harder than expected.

Build settings

First you should change your project ARCH flags to tell the gcc compiler it should be built for 64-bit. You can do this in Project → Edit Project Settings, choose the Build tab and look for the Architectures or ARCHS parameter. Choose the 64-bit or Universal mode (if you need to support Tiger).

This is not enough, however. If you try to build and install your application, you’ll notice it’s still running in 32-bit, stubborn prefpane.

The 64-bit System Preferences application also uses garbage collection and all 64-bit prefpanes need to support this as well. You can enable this in the same build panel under the Objective-C Garbage Collection or GCC_ENABLE_OBJC_GC parameter. Choose the Supported or Required option, again, depending on what you want to support.

Clean and build your application again, check for warnings and try it out. Looking better now?

64-bit gotchas