Changing __MyCompanyName__ in XCode

Scenario

You start a new project in XCode, and it rather cutely picks up your name from the Address Book, and attributes you as the creator of the auto-generated code. However, in a rather sterile fashion, it tells you that the code is the copyright to  __MyCompanyName__.

// Created by John Doe on 04/10/2009
// Copyright __MyCompanyName__ 2009. All rights reserved.

I can think of things I would rather set this to, so how can we change it, without editing every file that is created?

Solutions

1. Changing the company name of code that you write, in Address Book

Unsurprisingly, XCode also grabs your company information from your Address Book entry.

Open Address Book, and make sure you have entered a name in the Company field on your own Card.

Company field set in Address Book

XCode will check this field when creating new projects and files, and enter your assigned Company of the copyright owner of the work you create.

This may or may not be what you want to achieve.

2. Changing the default value for company names

If you would rather not have a company name in your Address Book, or if you don’t want the copyright of your code attributed to that company name, you can change the default value XCode uses. You might, for example,  prefer to use your own name in the copyright line.

Open a Terminal window, and type the following command (on a single line):

defaults write com.apple.Xcode PBXCustomTemplateMacroDefinitions -dict ORGANIZATIONNAME "Funky Monkey Futures, Inc"

This will result in all new files having your chosen company name in the copyright attribution, regardless of your Address Book entry.

// Created by John Doe on 04/10/2009
// Copyright Funky Monkey Futures, Inc 2009. All rights reserved.

Note: This option will override your Address Book settings, rather than act as a default if that setting is missing.

Disclaimer

The above information is true as of XCode 3.1 running on Leopard.

Posted on October 4, 2009 at 11:56 am by d. · Permalink
In: XCode · Tagged with: ,

Leave a Reply