This Thing I Do!

It’s been an interesting couple months with all these versions of iOS. Until last week, most of us had to juggle one legacy version (3.x), a production version (4.0 or 4.1), and the important 4.2 beta, which ushered iPad into the modern age. If you’re working on code for production, you likely needed to focus on at least two of these, possibly all three.

The Xcode tools have a reasonable means of letting you do this, by installing to locations other than the default /Developer with a few caveats, such as that a single set of the System Tools and the UNIX stuff can be present on a volume, and must be in specific locations.

My standard is to put the legacy SDK (currently 3.2) at /Developer_Old, the current production release at /Developer, and the latest beta at /Developer_New. So far so good. But what happens when you double-click an .xcodeproj or .xib… which version do you get? Do you notice or care? Probably not until you find out that the target SDK in the project file is unsupported by the version you launched. And what if you run multiple copies at once… what version of IB or the Simulator is that on your dock?

After fooling myself one time too many, I adopted a system of changing the icons of the core tools to give myself a visual indication of which SDK I’m working with. This way, I can start a specific version of Xcode right from my dock:
Aliases to different versions of Xcode

Here’s a quick look at how you can set this up for yourself.

Basically, what you need to do is to create alternate versions of the .icns files of the apps you’re interested in. For me, that’s Xcode, Interface Builder, and the iOS Simulator. I’ve created two folders, in /Developer/Xcode and simulator icons to store these .icns files permanently.:

Futuristic versions of icons
Old-timey versions of icons

As you can see, I’ve got one folder called Futuristic for the icons for betas, and another called Old Timey for the legacy SDKs.

To make these icons, start by visiting an application’s installed location in the Finder:

  • Xcode – /Developer/Applications/
  • Interface Builder – /Developer/Applications/Interface
  • iOS Simulator – /Developer/Platforms/iPhoneSimulator.platform/Developer/iOS

Now, peek into the application by right-clicking/ctrl-clicking the app and choosing “Show package contents”, then open the “Resources” folder. You need to find the appropriate .icns file:

  • Xcode – appicon.icns
  • Interface Builder – InterfaceBuilder_App.icns
  • iOS Simulator – simulator.icns

Don’t double-click the .icns; that will probably just open Preview. Instead, make a copy and use “Open With…” (via File menu or right-click/ctrl-click contextual menu) to open up Icon Composer.
Interface Builder icon in Icon Composer

This shows the icon at the various canned sizes: 512×512, 256×256, etc. Select one of these and copy with cmd-c.

Now open an image editor… I’ve used both Pixelmator and Acorn for this kind of stuff. You don’t have to buy Photoshop. For this blog, let’s assume you’re using Acorn. Over there, do “New from cilpboard” to create a new document of the image you’ve copied from the icon. Now choose an image effect that will colorize the icon in some meaningful way, without changing its size or shape. In my case, for the old-timey look of legacy SDKs, I applied the “Sepia Tone” effect:
Applying Sepia Tone effect to Interface Builder icon

And for the futuristic look to distinguish beta SDKs, I used the Quartz Composer “thermal camera” effect:
Interface Builder icon with thermal camera effect

Copy this image, close it, go back to Icon Composer, and paste it in. Repeat for all the other sizes. When finished, use “Save As…” to save the .icns file to some safe place (I use /Developer/Xcode and simulator icons).

Now, re-visit the legacy or beta applications whose icons you want to change, and option-drag your hacked .icns file into the Resources folder, replacing the default icon (you might want to do this on a copy of the application the first few times, just to make sure you’re doing it right).

Now, when you launch these apps, you’ll be able to tell immediately which is which in the Dock.
Three different versions of Xcode running side-by-side
You can also collect aliases to each version in a single folder, then put that in the Dock (as I did with Xcode in the first screenshot) for a one-stop shop to launch the version you need.

Comments (3)

  1. […] This Thing I Do! A nice way to deal with having 3 separate versions of Xcode installed. (tags: xcode development) Categories: Uncategorized LikeBe the first to like this post. links for 2010-11-19 RSS feed […]

  2. A slightly easier way to change the icon is to use Finder’s Get Info, click on the icon, and then paste in the new icon. This is a feature from the pre-MacOS X days that still works, even in Snow Leopard. It’s much nicer way of doing things without requiring modifying the package contents.

  3. […] @andrewroycarter “@rodstrougo: Good tip on How to keep 3 Xcode versions on your Mac at once […]

Leave a Reply

Your email address will not be published. Required fields are marked *

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