Xcode

Xcode Hints

Expert Preferences

Xcode maintains a list of "expert" preferences, which are not exposed through the GUI. A full list of these can be found [here], however the most useful are:

    defaults write com.apple.XCode XCShowUndoPastSaveWarning NO         # Disable "undo past last saved state" warning
    defaults write com.apple.Xcode PBXBuildFailureSound /path/to/sound  # Sound to play on build failure
    defaults write com.apple.Xcode PBXBuildSuccessSound /path/to/sound  # Sound to play on build success
    defaults write com.apple.Xcode PBXGDBDebuggerLogToFile YES          # Enable gdb logging (to capture gdb problems for Radar)
    defaults write com.apple.Xcode PBXCustomTemplateMacroDefinitions    # Customise template macros (e.g., change "ORGANIZATIONNAME")
    defaults write com.apple.Xcode NSRecentDocumentsLimit 20            # Show 20 recent projects (rather than default of 10)

Templates

also, see Creating Custom Project Templates and TemplateInfo.plist

Xcode uses templates to control newly created projects, targets, and source files. These are located at /Libraray/Application Support/Apple/Developer Tools/, and include:

You can change these files or add new ones of your own. For example, to customise newly created .cpp files with a skeleton class definition you would edit the files under "File Templates/Carbon/C++ File.pbfiletemplate". E.g., file.cpp could be changed to:

//------------------------------------------------------------------------------------------
//  FILENAME
//  PROJECTNAME
//
//  Created by FULLUSERNAME on DATE.
//  Copyright YEAR ORGANIZATIONNAME. All rights reserved.
//------------------------------------------------------------------------------------------

#include "FILEBASENAME.h"

//------------------------------------------------------------------------------------------
FILEBASENAME::FILEBASENAME()
{
}
//------------------------------------------------------------------------------------------
FILEBASENAME::~FILEBASENAME()
{
}

And file.h:

//------------------------------------------------------------------------------------------
//  FILENAME
//  PROJECTNAME
//
//  Created by FULLUSERNAME on DATE.
//  Copyright YEAR ORGANIZATIONNAME. All rights reserved.
//------------------------------------------------------------------------------------------

#include <Carbon/Carbon.h>

class FILEBASENAME
{
public:
	FILEBASENAME();
	virtual ~FILEBASENAME();
	
};

Template Macros

To customise the macros used by templates, you can modify the PBXCustomTemplateMacroDefinitions dictionary. This can be accessed through the "com.apple.Xcode" domain via defaults, or by opening ~/Library/Preferences/com.apple.Xcode.plist in the Property List Editor application.

E.g., to modify ORGANIZATIONNAME you could use:

    defaults write com.apple.Xcode PBXCustomTemplateMacroDefinitions '{ "ORGANIZATIONNAME" = "My Company";}'

Project templates support the following macros:

File templates support the following macros:

Xcode's Plugin Interface

[ Xcode's Plugin Interface]

Other Resources

Some more resources for Xcode hints: