Whenever I create a new .cpp/.h file in Xcode a comment is added to the top of the file. For example:
/*
* .cpp
*
*
Try modifying this file:
/Developer/Library/Xcode/File\ Templates/C\ and\ C++/Header\ File.pbfiletemplate/header.h
Don't edit anything in /Developer as Apple can overwrite this at any time.
The following works for Xcode 4, 5 and 6 except later source differs and is under /Applications
Instead copy the templates that you want to change from /Applications/Xcode<version>.app/Contents/Developer/Library/Xcode/Templates
to ~/Library/Developer/Xcode/Templates/File Templates
and then edit the files keeping the same directory structure but edit the directory name that is the template to not show up a a duplicate in Xcode.
e.g for a new category of C/C+ files in Xcode 5 copy /Applications/Xcode.app/Contents/Developer/Library/Xcode/Templates/File Templates/C and C++
to ~/Library/Developer/Xcode/Templates/File Templates/GPL C and C++
this process is copied from Red Glasses's blog
For Xcode 4 the source path is or for Xcode 4 /Developer/Library/Xcode/Templates/File Templates
/Applications/Xcode.app/Contents/Developer/Library/Xcode/Templates
any update of your SDK will wipe changes here so keep your template backed up somewhere else
This blog post has some good steps for modifying file templates in Xcode 4.3:
http://error-success.piku.org.uk/2012/04/27/how-to-make-xcode-4-3-2-templates/
The /Developer
folder no longer exists, so you copy the templates from within the Xcode.app bundle located in /Applications
:
/Applications/Xcode.app/Contents/Developer/Library/Xcode/Templates/File\ Templates/
And place your modified copy here, as before:
~/Library/Developer/Xcode/Templates/File\ Templates/
UPDATE: I decided to write a script that would extract the built in Xcode templates and replace the headers. Source and instructions can be found at the following url:
https://github.com/royclarkson/xcode-templates
For AppCode users:
CMD + ,
)Editor
-File and Code Templates
Project
.idea/fileTemplates
if neededIn Xcode 4.2, they're here:
/Developer/Library/Xcode/Templates/File Templates