18

Recently I've been learning how to program C. For most of the time, I have been using the C version of Eclipse. Recently, I tried out Xcode. I am using a Mac running Mac OS X Lion - Xcode version 4.1.

There is one grievance I have: at the top of every file that I create, there is this little section of comments that I wish to remove or better yet, change.

When I create a file, something like this is put at the top of the file by default:

//
//  FILE.c
//  PROJECT NAME
//
//  Created by Martin Tuskevicius on DATE.
//  Copyright YEAR ORGANIZATION (my school name for some reason). All rights reserved.
//

Obviously the things in capitals would be replaced with an actual value. For those of you have use, or have used Xcode, for programming C - do you know a way of how to change or remove these default comments?

I really appreciate any help. Thanks!

Martin Tuskevicius
  • 2,590
  • 4
  • 29
  • 46
  • Maybe something in here will help? (http://stackoverflow.com/questions/33720/change-templates-in-xcode) – summea Feb 23 '12 at 02:33
  • I looked at that and did what it suggested - created new directories in the right place, etc. with no avail. – Martin Tuskevicius Feb 23 '12 at 04:38
  • Possible duplicate of [Change templates in Xcode](https://stackoverflow.com/questions/33720/change-templates-in-xcode) – Mogsdad Feb 27 '18 at 13:58

3 Answers3

11

UPDATE:

According to @Michael Dautermann 's comment below, change templates in Xcode.app bundle is not a good way. Check https://stackoverflow.com/a/33743/380774 for more information.


You can remove or change the header in File Templates, I'm using Xcode 4.3, and the File Templates is in /Applications/Xcode.app/Contents/Developer/Library/Xcode/Templates/File Templates.

Community
  • 1
  • 1
fannheyward
  • 18,599
  • 12
  • 71
  • 109
  • 1
    I would not recommend changing templates ***inside*** the Xcode app bundle, as Xcode is certainly a signed app and messing with any files within the application package might "break" Xcode to the point where it won't launch and will need to be re-installed. Instead, look at @summea's linked question above, where Chris Hanson (i.e. an actual Xcode engineer @ Apple, IIRC) provides some useful answers for where you can and should customize templates. – Michael Dautermann Feb 23 '12 at 04:07
  • Copy templates that you need from the path above to: `${HOME}/Library/Developer/Xcode/Templates/File` and modify them (create it first with `mkdir -p` and then `open` the path in Finder`. Then copy templates from bundle to here and remove comment from heading – Croll Nov 22 '18 at 20:22
8

Please do not edit files inside Xcode, that will break the application signature and will cause Xcode to refuse to start up after the next restart or so.

Create an IDETemplateMacros.plist file containing a dictionary with a FILEHEADER key (string) instead.

You can put the file in

  • for all users on a single project by dropping it in your project's or workspace's xcshareddata folder (e.g. MyAppWorkspace.xcworkspace/xcshareddata/IDETemplateMacros.plist)
  • for yourself for a single project by copying it into e.g MyAppWorkspace.xcworkspace/xcuserdata/YOURNAMEHERE.xcuserdatad
  • global for all projects that you open in your account by dropping the file in ~/Library/Developer/Xcode/UserData/
uliwitness
  • 8,532
  • 36
  • 58
  • This kind of worked but is still showing an empty line with // – juanjovn May 24 '23 at 16:02
  • 1
    Yes, sadly there's no way to delete the entire comment, Xcode will always insert the `// ` before it. But at least it won't break Xcode's signature in subtle ways and stay around across updates, and you can customize the header with your own text. – uliwitness May 26 '23 at 11:50
4

You can change it in Xcode project File. This is my image for tutorial :D Very easy!!! change Organization in Xcode

Linh Nguyen
  • 2,006
  • 1
  • 20
  • 16