I Don’t Work For __MyCompanyName__
Welcome to Colour Me Cocoa.
Looks like you're new here. If you like what you see, you may want to subscribe to my RSS feed, or if you prefer sign up to receive email updates.
Thanks for visiting!
Doesn’t it just annoy you that every time you create a new file in Xcode you have to change the company name? I don’t work for __MyCompanyName__, do you? Today I got sick of replacing that block of text and went in search of a solution.
The answer can be found in the Xcode 2.4 Expert Preferences Notes. PBXCustomTemplateMacroDefinitions is a dictionary that allows you to setup macros for use in the default templates. ORGANIZATIONNAME is the macro that defaults to __MyCompanyName__ and we can set that using the terminal.
Open up the terminal (found in Applications/Utilities/) and run the following command to set ORGANIZATIONNAME to whatever is appropriate for you. I’ve used my name. Please note, you should run this all on one line, I’ve only added line breaks to make it fit nicely on the page.
defaults write com.apple.xcode
PBXCustomTemplateMacroDefinitions
'{ ORGANIZATIONNAME = "Gareth Townsend"; }'
Now whenever Xcode creates a new file my name will be placed in the automatic copyright comments. Hooray!
There are a lot of other expert preferences listing in the documentation, so have a look through it and see if there’s something else of interest to you. If you do find something interesting then be sure to let us know in the comments.
April 15th, 2007 at 8:46 pm
Thanks for the tip! I was wondering about that today, as I am a newbie. I am learning Xcode at the moment.
I’ll be sure to read that documentation also.
June 22nd, 2007 at 1:53 am
[…] looking for how to have XCode stop inserting the Copyright __MyCompanyName__ tag in new files, Color Me Cocoa has the solution. Simply execute the following command in a terminal window and set the string to […]