Restart Xcode

January 17th, 2007

As much as I basically like Xcode, let’s just say it’s not without its infuriating quirks. Among these quirks are a number of subtle bugs that seriously degrade its usability, but that only seem to appear after using it for several hours or days. Your text editors stop showing your changes, the spinning pizza of death is appearing more often, the index doesn’t quite seem to be working. Xcode has poor uptime, when compared with Mac OS X itself.

The workaround is, of course to simply restart Xcode when it gets flakey. But often this is an ordeal because you then have to go through your recent projects and manually reopen the one (or ones) that you were working on. I found myself frequently cmd-clicking the project window’s title to get a Finder reference to the project, so I could quickly reopen it after quitting.

Restart Xcode does all of this for you. Save the script to your ~/Scripts/Applications/Xcode folder, and keep it at easy reach from FastScripts or the Apple Script Menu. When you run it, it asks Xcode to quit, but not before accumulating a list of all the project documents you’ve got open. It waits for the quit to finish, then promptly reopens Xcode and all the documents.

Until Apple improves the uptime of Xcode, this script is going to save me a lot of frustration.

8 Responses to “Restart Xcode”

  1. Joachim Bengtsson Says:

    File > Recent Projects doesn’t work…?

    Oh, and the MOST annoying bug of all time must be the one where, when you save and then build semi-quickly thereafter, the build uses an OLD version of the file! So you get bugs because you probably saved before it was done… This is most annoying when you don’t get a compilation error, all that happens is that you get an old version, and you get frustrated because *nothing that you coded works or even shows up*! Until you build again. I haven’t found a 100% way to reproduce it, though…

  2. Daniel Jalkut Says:

    Joachim: sure, the recent items work. But that’s just more brain cells I have to waste on filtering through noise. You also typically have to wait while Xcode slogs through opening one, before you can get it responsive enough to open another. Scripts are ideal for these types of repetitive nuisances.

    I haven’t seen the save-quick-build bug you’re describing. Thankfully!

  3. Petteri Kamppuri Says:

    Thanks! This script will save me a lot of time. What I did was I saved it as an application and put it to a location where Quicksilver can find it. Oh the joy!

    I think I’ve run into the the save-quick-build bug a few times. I just didn’t realize it could be that. But a few times I haven’t seen any of the new behaviour I’ve just coded until I build and run again. Thanks to Joachim for pointing this bug out, now I’m more aware of it.

  4. Jens Ayton Says:

    While I”™m not prepared to select one very-worst Xcode bug — there are so many to choose from — the one Joachim mentions is indeed a serious candidate.

  5. dgohara Says:

    I just did a quick application note on a program called Relaunch. It’s very good and works with a lot of applications, including Xcode. See my note about orphaned windows though.

  6. Mark Dalrymple Says:

    People may deride emacs for whatever reason, but I frequently enjoy 30+ day uptimes of a single session. Even with a couple hundred files open and several 30+ day shell sessions, it’s still a smaller (real and virtual) process than things like GrowlHelper, translate, coreservicesd, mds, and every graphical app.

  7. Richy Says:

    I’m constantly amazed by how useful AppleScript is, part of the reason I regularly read this blog.. :)

    Oh and thanks for the Relaunch plug dgohara :) I was going to mention that it does, indeed, support XCode.

  8. Henrik N Says:

    I use Quicksilver to relaunch projects – I set MyProject.xcodeproj as the default for “MyProject” (⌃+click a result, “Set as Default for …”), so I can just trigger QS, type the name of my project and launch it in Xcode.

    My Xcode restarts have decreased dramatically, though, since I realized the reason I sometimes got un-closeable (until Xcode reboot) instances of my built-and-gone app, was that a debugger window had opened and needed me to “Terminate”.

Comments are Closed.

Follow the Conversation

Stay up-to-date by subscribing to the Comments RSS Feed for this entry.