User and company name comments in Xcode projects

Question: I am wondering how you change the comments that Xcode puts in the top of each source file to set the proper username and company name instead of updating every file by hand if these macro fields are different from the default settings of Address Book. I am speaking about these source code lines: // Created by  MyUserName on 8/19/10. // Copyright __MyCompanyName__ 2010. All rights reserved. Answer: Since the Xcode 3.1 the USERNAME and ORGANIZATIONNAME values in templates are replaced with the User Name and Company Name from the current user’s Address Book card, if present. In Xcode 4+ you can set the company name in your project settings. See File -> Get Info -> Organization Name. With this utility you can easily assign individual company names to your projects. If the PBXCustomTemplateMacroDefinitions user default has already been set, it will be honored by Xcode 3.1+. So the answer is here:
  1. Close your Xcode.
  2. Open the Finder.
  3. Navigate to (your) Library\Preferences folder. Open the file.
  4. Find, open (or create) the PBXCustomTemplateMacroDefinitions dictionary key.
  5. Modify or add the ORGANIZATIONNAME key as a String if not present, set the value to your desire.
  6. Modify or add the USERNAME key as a String if not present, set the value.
  7. Save changes.
  8. Open Xcode.
How to set Xcode to show user and company name
Comment settings for Xcode projects
By using the Terminal window you can avoid the hassle of changing the plist file manually. Run the defaults command:
defaults write PBXCustomTemplateMacroDefinitions '{"ORGANIZATIONNAME" = "WHATEVER Name Here";}'

defaults write PBXCustomTemplateMacroDefinitions '{"USERNAME" = "WHOEVER Name Here";}'
—- do not forget to hit Return :-) If you want to find out what expansion macros you have defined, you can do this:
defaults read PBXCustomTemplateMacroDefinitions
Some interesting macros:
___PROJECTNAMEASIDENTIFIER___ The project name (every filename illegal character has been replaced with an underscore).
___PROJECTNAME___ The name of the project as entered by the user during the New Project wizard.
___PROJECTNAMEASXML__ The __PROJECTNAME__ but converted to a valid XML string.
___FULLUSERNAME___ The full name of the developer who created the project (retrieved from the account information)
___USERNAME___ The short name of the developer who created the project.
___TIME___ The time of the day when the project was created.
___YEAR___ The year in which the project was created.
___ORGANIZATIONNAME___ The name of the company or organization for which the developer works.
___UUID___ A unique identifier generated for the project.
___UUIDASIDENTIFIER___ the __UID__, but all the illegal characters are replaced with underscores.
You can add your own macros, if you execute the defaults command in the terminal window or edit the file manually: defaults write PBXCustomTemplateMacroDefinitions ‘{ “MYAPPMACRO” = “Some Very Cool Staff”;}’ Note that you are able to add and store user templates that will not be removed when you install a new Xcode version. The location for these files is: /Library/Application Support/Developer/Shared/Xcode/Project Templates/ Do not panic if this folder is missing. You can create this path and it will be picked up by the Xcode. All the project templates are categorized with names like Applications, Library, and for your own custom template you must create a new category like MyTemplates.