Migrating themes from Xcode 3 to Xcode 4 developer previews

Posted by Michael Dales on Jan. 24, 2011, 9:41 a.m.

I've been trying out the Xcode 4 Developer Previews, and the first thing that hit me was the current DPs don't find your nice font/colour settings for the code editor - a trivial thing on one hand, but something most coders are very sensitive about :) In this post we take a quick look at how to solve this.

I've been trying out the Xcode 4 Developer Previews, and the first thing that hit me was the current DPs don't find your nice font/colour settings for the code editor - a trivial thing on one hand, but something most coders are very sensitive about :)

The issue is it's not just a file location change (that is also the case), but it's also a file format change, so you can't just move your old custom theme into place. Thankfully aktowns has provided a nice ruby script to convert the themes from old to new format. You can grab the script from here - I modified it only to make it run slightly more easily on a stock ruby environment.

So, to migrate your themes:

  1. Install the "plist" ruby gem with: sudo gem install plist
  2. Download the script, and know where it is :)
  3. Your custom Xcode 3 themes are saved in ~/Library/Application Support/Xcode/Color Themes, go find the file there that you want to migrate (it'll have a .xccolortheme extension)
  4. Run dvtcolorconvert.rb passing it the path to your theme file
  5. It'll create a file in the same directory containing the theme in the new format with a .dvtcolortheme extension
  6. Move the .dvtcolortheme file into ~/Library/Developer/Xcode/UserData/FontAndColorThemes
  7. Restart Xcode 4

And your theme should now appear in the Xcode preferences. I found that it wasn't perfect - the font size got confused - but with developer previews I'd expect a little inconsistency. That said it was a few seconds to correct for that, compared to migrating it all by hand!