When you create a new file in Xcode, the IDE automatically adds a header comment that includes information like the filename, creation date, and author. By default, the author name is derived from your macOS system's full username. However, you might want to customize this for various reasons - perhaps you're sharing code publicly, working on a team project, or simply prefer a different name format.
This article explains multiple methods to customize the "Created by" author name in Xcode.
When you create a new file in Xcode, you'll see a header comment like this:
//
// ViewController.swift
// MyApp
//
// Created by John Smith on 3/11/2025.
//
The Created by
value is populated from a template macro named ___FULLUSERNAME___
, which by default pulls your system's full user name.
The easiest and most maintainable way to customize your author name is using the macOS defaults
command to modify Xcode's template macros.
# Create the UserData directory if it doesn't exist
mkdir -p ~/Library/Developer/Xcode/UserData/
# Set the custom author name
defaults write ~/Library/Developer/Xcode/UserData/IDETemplateMacros FULLUSERNAME "John Developer"
You can confirm the change was applied by reading the values:
# Read the current settings
defaults read ~/Library/Developer/Xcode/UserData/IDETemplateMacros
# Expected output:
# {
# FULLUSERNAME = "John Developer";
# }
If you want to revert to using your system username:
# Remove the custom setting
defaults delete ~/Library/Developer/Xcode/UserData/IDETemplateMacros FULLUSERNAME
You can also manually create or edit the template macros plist file:
# Create the plist file with proper XML structure
cat > ~/Library/Developer/Xcode/UserData/IDETemplateMacros.plist << EOF
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>FULLUSERNAME</key>
<string>John Developer</string>
</dict>
</plist>
EOF
Xcode uses several macros in its templates. You can customize multiple values at once:
# Set multiple template values
defaults write ~/Library/Developer/Xcode/UserData/IDETemplateMacros << EOF
{
FULLUSERNAME = "John Developer";
ORGANIZATIONNAME = "Awesome Company";
COPYRIGHT = "Copyright © 2025 John Developer. All rights reserved.";
}
EOF
You can also set project-specific author information:
# Create a project-specific template macros file
mkdir -p /path/to/YourProject.xcodeproj/xcuserdata/$(whoami).xcuserdatad/
cat > /path/to/YourProject.xcodeproj/xcuserdata/$(whoami).xcuserdatad/IDETemplateMacros.plist << EOF
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>FULLUSERNAME</key>
<string>Project Author</string>
</dict>
</plist>
EOF
Xcode looks for template macros in the following order:
- Project-level:
<YourProject>.xcodeproj/xcuserdata/<username>.xcuserdatad/IDETemplateMacros.plist
- User-level:
~/Library/Developer/Xcode/UserData/IDETemplateMacros.plist
- Global-level:
/Applications/Xcode.app/Contents/Developer/Library/Xcode/Templates/IDETemplateMacros.plist
The more specific (project-level) settings will override the more general ones.
While it's possible to modify the global Xcode settings using:
# Not recommended - changes may be lost during Xcode updates
sudo defaults write com.apple.dt.Xcode PBXCustomTemplateMacroDefinitions '{"FULLUSERNAME" = "John Developer";}'
This method is not recommended as your changes might be lost during Xcode updates.
If your changes don't take effect immediately:
# Force quit Xcode
killall Xcode
# Clear Xcode caches
rm -rf ~/Library/Developer/Xcode/DerivedData/
rm -rf ~/Library/Caches/com.apple.dt.Xcode/
Using the defaults
command to modify ~/Library/Developer/Xcode/UserData/IDETemplateMacros.plist
is the most reliable way to customize your Xcode author name. It survives Xcode updates and doesn't require modifying system settings or Xcode's internal templates.
Remember to restart Xcode after making these changes for them to take effect.