A Swift command-line tool that safely renames your entire Xcode project. It updates file names, folder names, and text content throughout your project while avoiding generated files and dependencies.
When you rename an Xcode project, you need to update:
- File and folder names containing the old project name
- Text occurrences in source files, project files, schemes, and plists
- Bundle identifiers (optional)
xcrename does all of this automatically and safely.
Step 1: Build the tool
swift buildStep 2: Preview what will change (always do this first!)
./.build/debug/xcrename --path ./MyApp --old MyApp --new NewApp --dry-runStep 3: Apply the rename
./.build/debug/xcrename --path ./MyApp --old MyApp --new NewAppStep 4: Open in Xcode and verify
That's it! The tool creates backups (.xcrename.bak) of all modified files.
git clone <your-repo-url>
cd xcrename
swift buildAfter building, run the tool from .build/debug/xcrename or install it system-wide (see below).
Recommended: Install to ~/bin (no sudo needed)
mkdir -p ~/bin
cp .build/debug/xcrename ~/bin/
echo 'export PATH="$HOME/bin:$PATH"' >> ~/.zshrc
source ~/.zshrcAlternative: Install to /usr/local/bin (requires sudo)
sudo cp .build/debug/xcrename /usr/local/bin/After installation, you can use xcrename from anywhere.
Rename a project from MyApp to NewApp:
# Preview first
./.build/debug/xcrename --path ./MyApp --old MyApp --new NewApp --dry-run
# Then apply
./.build/debug/xcrename --path ./MyApp --old MyApp --new NewAppIf your project folder is named MyApp and you want it renamed to NewApp:
./.build/debug/xcrename --path ./MyApp --old MyApp --new NewApp --rename-rootSet a specific bundle identifier during rename:
./.build/debug/xcrename \
--path ./MyApp \
--old MyApp \
--new NewApp \
--bundle-id com.company.newappYou can use relative or absolute paths:
# Relative path
./.build/debug/xcrename --path ./MyApp --old MyApp --new NewApp
# Absolute path
./.build/debug/xcrename --path ~/Projects/MyApp --old MyApp --new NewApp
# Path with spaces (use quotes)
./.build/debug/xcrename --path "./My App" --old MyApp --new NewApp--path <folder>- Path to your Xcode project folder (contains.xcodeprojor.xcworkspace)--old <name>- Current project name to find and replace--new <name>- New project name to replace with
--dry-run- Preview changes without modifying files (use this first!)--rename-root- Also rename the root project folder if it contains the old name--bundle-id <id>- Set bundle identifier to this exact value (e.g.,com.company.app)--skip-scheme-rename- Don't rename.xcschemefiles-h,--help- Show help
✅ Updated:
- File and folder names containing the old name
- Text in Swift/Objective-C source files
- Project files (
.pbxproj,.xcscheme,.plist) - Bundle identifiers (when using
--bundle-id)
❌ Skipped:
- Generated folders:
Pods,.build,DerivedData,Carthage,build,node_modules - Git folder (
.git) - Binary files
- Files larger than 25MB
- Symlinks
- Backups: Every modified file gets a
.xcrename.bakbackup - Dry-run mode: Preview all changes before applying
- Bundle ID protection: Bundle identifiers are protected unless you use
--bundle-id - Collision detection: Stops if renaming would overwrite existing files
- Commit your project to git (good practice)
- Run with
--dry-runto see what will change - Review the output carefully
- Run without
--dry-runto apply changes - Open in Xcode and verify everything works
- Build and test your project
- macOS
- Xcode / Swift toolchain
- Swift 5.9+
- "No such file or directory": Make sure the
--pathpoints to your project folder - "Permission denied": Make sure you have write access to the project folder
- Files not updating: Check that the
--oldname matches what's actually in your project - Want to undo: Restore from
.xcrename.bakbackup files or use git