Skip to content

Instantly share code, notes, and snippets.

@jyshnkr
Last active April 30, 2025 16:28
Show Gist options
  • Save jyshnkr/23cf9c470e129f417940f32924cfb481 to your computer and use it in GitHub Desktop.
Save jyshnkr/23cf9c470e129f417940f32924cfb481 to your computer and use it in GitHub Desktop.
How to Rename the Xcode Project (Including all the files & folders)

Rename the Xcode Project (Including Files and Folders)

Step 1 - Rename the project:

  1. Click on the project you want to rename in the "Project navigator" in the left panel of the Xcode window.

  2. In the right panel, select the "File inspector", and the name of your project should be found under "Identity and Type". Change it to your new name.

  3. When the dialog asks whether to rename or not rename the project's content items, click "Rename". Say yes to any warning about uncommitted changes.

Step 2 - Rename the scheme:

  1. At the top of the window, next to the "Stop" button, there is a scheme for your product under its old name; click on it, then choose "Manage Schemes…".

  2. Click on the old name in the scheme and it will become editable; change the name and click "Close".

Step 3 - Rename the folder with your assets:

  1. Quit Xcode. Rename the master folder that contains all your project files.

  2. In the correctly-named master folder, beside your newly-named .xcodeproj file, there is probably a wrongly-named OLD folder containing your source files. Rename the OLD folder to your new name (if you use Git, you could run git mv oldname newname so that Git recognizes this is a move, rather than deleting/adding new files).

  3. Re-open the project in Xcode. If you see a warning "The folder OLD does not exist", dismiss the warning. The source files in the renamed folder will have red names because the path to them has broken.

  4. In the "Project navigator" in the left-hand panel, click on the top-level folder representing the OLD folder you renamed.

  5. In the right-hand panel, under "Identity and Type", change the "Name" field from the OLD name to the new name.

  6. Just below that field is a "Location" menu. If the full path has not corrected itself, click on the nearby folder icon and choose the renamed folder. You may have to perform this fix for each source file if the links to them remain broken.

Step 4 - Rename the Build plist data

  1. Click on the project in the "Project navigator" on the left, and in the main panel select "Build Settings".

  2. Search for "plist" in the settings.

  3. In the Packaging section, you will see fields for Info.plist and Product Bundle Identifier.

  4. If there is a file name entered in Info.plist, update it (it may have been updated automatically in Step 1).

  5. Do the same for Product Bundle Identifier, unless it is utilizing the ${PRODUCT_NAME} variable. In that case, search for "product" in the settings and update Product Name. If Product Name is based on ${TARGET_NAME}, click on the actual target item in the TARGETS list on the left of the settings pane and edit it, and all related settings will update immediately.

  6. Search the settings for "prefix" and ensure that Prefix Header's path is also updated to the new name.

  7. If you use SwiftUI, search for "Development Assets" and update the path.

Step 5 - Repeat step 3 for tests (if you have them)

Step 6 - Repeat step 3 for core data if its name matches project name (if you have it)

Step 7 - Clean and rebuild your project

  1. Command + Shift + K to clean
  2. Command + B to build
@vdhamer
Copy link

vdhamer commented Dec 15, 2023

Careful about updating **Product Bundle Identifier** if there are already releases of your app in the App Store. That bundle identifier is Apple's unique id for apps.

By changing the bundle identifier the old and the renamed app

  • will coexist on the App Store (without a link from old to new).
  • and a user with an installed old version of the app will see the renamed app alongside the original app
  • any data in CoreData/SwiftData or in UserDefaults will not be copied over to the new app
  • so for all practical purposes the original app version and the renamed version are unrelated.

By keeping the old bundle identifier and also using it for the renamed app

  • there will be a single app (with the new name) on the App Store
  • users who have the original version installed will see there is update
  • and upon update, the renamed app will replace the old app
  • and any data in CoreData/SwiftData and in UserDefaults will be maintained
  • so for all practical purposes the renamed version is an upgrade of the original version
  • the only drawback of this scenario is that a user may sometimes briefly see the bundle identifier (in URLs??)

Hope this helps somebody.

@doyletim
Copy link

doyletim commented Nov 9, 2024

Fix: Xcode crashes renaming broken (red) project files

If you have renamed your project, edited your scheme and updated your project folder, and now finding Xcode crashes while trying to fix the broken paths in the Inspector. Here's a fix:

  1. After following steps 1-3 and quitting Xcode, right click your .xcodeproj package and choose Show Package Contents.
  2. Open the .pbxproj file in a text editor (or Xcode by default).
  3. Do a Find & Replace for your old project name and replace with your new project name.
  4. Close the file and back in your project folder, manually update your .entitlements and App.swift filenames.

It should now build and run. Continue to update your plist settings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment