Restart Xcode

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.