Change templates in Xcode

Misha M picture Misha M · Aug 29, 2008 · Viewed 47k times · Source

How would I change the initial templates created by Xcode when creating a new Cocoa Class.

I am referring to the comments and class name created when using Xcode's new class wizard.

Answer

Chris Hanson picture Chris Hanson · Aug 29, 2008

You wouldn't change the existing templates. In other words, don't modify anything under the /Developer hierarchy (or wherever you installed your developer tools).

Instead, clone the templates you want to have customized variants of. Then change their names and the information in them. Finally, put them in the appropriate location in your account's Library/Application Support folder, specifically:

  • File templates: ~/Library/Application Support/Developer/Shared/Xcode/File Templates/
  • Target templates: ~/Library/Application Support/Developer/Shared/Xcode/Target Templates/
  • Project templates: ~/Library/Application Support/Developer/Shared/Xcode/Project Templates/

That way they won't be overwritten when you install new developer tools, and you can tweak them to your heart's content.

Update For newer versions of Xcode the updated path will be: ~/Library/Developer/Xcode/Templates/File Templates/Source