682

I have a project named XXX. I want to rename this project to YYY.

Note that XXX is an extremely common term (for e.g. "data", or simply "project"), and thus a simple RegEx search-and-replace is not possible, out of risk of corrupting the project configuration files.

My current project directory contains the following items:

  • XXX
  • XXXTests
  • XXX.xcodeproj

and I want to rename them to:

  • YYY
  • YYYTests
  • YYY.xcodeproj

... respectively, with the necessary changes being reflected in my project file.

How can I accomplish this without having to manually create and populate a new project?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Vatsal Manot
  • 17,695
  • 9
  • 44
  • 80
  • 1
    Possible duplicate of [Rename xcode project](http://stackoverflow.com/questions/22826826/rename-xcode-project) – Ron Myschuk Oct 27 '15 at 16:47
  • 1
    Also asked and answered here http://stackoverflow.com/questions/17744319/duplicate-and-rename-xcode-project-associated-folders with 200 up votes on the answer – Ron Myschuk Oct 27 '15 at 17:12
  • 1
    also asked and answered here http://stackoverflow.com/questions/8262613/renaming-xcode-4-project-and-the-actual-folder with 189 up votes both posts are still relevant in Xcode 7 – Ron Myschuk Oct 27 '15 at 17:13
  • If you just want to rename the app icon name, check this answer https://stackoverflow.com/questions/238980/how-to-change-the-name-of-an-ios-app – LYu Jun 15 '17 at 04:13

12 Answers12

1391

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

Note: for Xcode 14, Sept. 2022: in some cases Xcode now automatically renames the scheme, when Xcode performs Step 1 above. If so, there is nothing to do in Step 2.

  1. At the top middle of the window, to the left of the active device/simulator, there is a scheme for your product under its old name; click & hold on it, then choose "Manage Schemes…".
  2. Click on the old name in the scheme (similar to renaming files in Xcode) 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 use git mv oldname newname. Note that when using git mv old new you generally must (i) completely commit all other changes (ii) only then git mv old new (iii) commit that (iv) only then make further changes. If steps i-ii-iii-iv are followed, git will maintain history through the rename.}
  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. Enclose in double-quotes ("") quotes if the path contains a space ( ).
  8. If you have an entitlements file, search for "signing" and update Code Signing Entitlements. Accordingly, rename the actual entitlements file in the Project Navigator also. (Side note: In Xcode 13 entitlements files have a yellow checkmark icon in the Project Navigator; you may have created one if e.g. you use shared containers/App Groups.)

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

Further points.

  • If the project has storyboards.

At this stage, open the overall folder simply in the Mac finder. Type the old name in the file text search. You will see that the old name appears very often as customModule="OldName" in all storyboard files. (Explanation.) These can be fixed, in Xcode, one by one, on each storyboard: Tap on the view controller in the file inspector, and be sure to tap on the actual storyboard in the white column on the left of the actual storyboard panel. Tap on the Identity Inspector (4th small button) in the right hand panel. Look at the Custom Class -> Module field. Notice it seemingly shows NewName in gray. However (still as of Xcode14.2) it is incorrect. Simply tap the drop-down, and explicitly select the new name. (If you now review that storyboard file with a text editor, you will see it is fixed.) You may prefer to change them all just using a plain text editor.

Fattie
  • 27,874
  • 70
  • 431
  • 719
Luke West
  • 14,183
  • 1
  • 16
  • 8
  • This is a great start. If you're playing with copy files in build phases etc you probably have to open the project package and do a search and replace. – johnrubythecat Sep 11 '16 at 05:12
  • 5
    You are able to change the name of project but the folders names are still the same. Do you know how to change those – Coder221 Sep 15 '16 at 04:55
  • 1
    Worked in Xcode 8, thanks! . Also, I would add that step 4 would have to be repeated as many times as 'sub'projects you have. By default Xcode creates the 'iosTest' and 'iosUITest' subprojects. – jos Oct 01 '16 at 09:54
  • 9
    Thanks! for Xcode 8, the entitlements file should be renamed manually. – Jiulong Zhao Oct 24 '16 at 22:30
  • 2
    Generally worked. Also needed to change Build Settings > Testing > Test Host paths from ..../OLD.app/OLD to ..../NEW.app/NEW – oortCloud Nov 02 '16 at 05:24
  • 2
    Worked like a charm! Also if you have unit tests and UI tests targets, repeat steps 3 and 4 for those. – Ferschae Naej Nov 22 '16 at 03:01
  • 66
    When doing step 3 part 2 (renaming the folder), if you're using git, I recommend `git mv oldname newname`, that way git will recognize that it was a move, not deleting and adding all your files. – Aaron Ash Nov 22 '16 at 11:14
  • 18
    perfect, works perfectly in Xcode 8.2, just one thing to point out here while editing the scheme **if clicking on the scheme name once doesn't make it editable** then select the scheme and hit return key this will make the scheme name editable. – Khurram Shehzad Jan 31 '17 at 05:47
  • 7
    Don't forget to [find & replace](http://stackoverflow.com/questions/19116435/xcode-find-and-replace-in-all-project-files) other instances of your old project name. – Derek Soike Feb 06 '17 at 17:37
  • 1
    That worked nicely (Xcode 8.2.1). However, I am now getting a bunch of "Missing File" compiler warnings about almost all of my files. The target still compiles, but it's looking in NewName/OldName/AppDelegate.h, for example. I tried cleaning to no avail. Any ideas? – BigSauce Mar 20 '17 at 21:02
  • @BigSauce are you using git? I have also experienced this and it was caused by files not being committed. – Jerguš Lejko Apr 09 '17 at 13:26
  • One last thing, if anyone is using Git as their code-management tool, you may notice a bunch of warnings (including compiler warnings). After doing a git add -A and git commit -am "...", these will get removed from Xcode. – Achintya Ashok Apr 15 '17 at 22:46
  • @JergušLejko Yea I'm using git. To my knowledge, all the files were being tracked already. – BigSauce Apr 21 '17 at 17:36
  • @BigSauce yeah, an actual commit fixed this for me. Not just tracking those files. – Jerguš Lejko Apr 23 '17 at 09:57
  • 4
    Perfect! Using CoreData, you can also rename the xcdatamodeld and change the name for the NSPersistentContainer in AppDelegate – Retterdesdialogs Apr 28 '17 at 08:14
  • 1
    Great answer, although I also needed to set the executable on the scheme afterwards using the steps found here: https://stackoverflow.com/a/8378445/433649 – rankAmateur Aug 08 '17 at 10:50
  • i have a pod file in my project . after following your first step , pod file name did not change to new one . and then i changed the folder name as step 2 . after i reopened the project but in xcode , there is no file available . what happen here ? – Moxarth Sep 26 '17 at 06:05
  • As @AaronAsh mentioned if using Git getting past point 3.2 may be problematic. When I tried the utilities pane was locked when reopening Xcode. Going back a couple of steps and changing the file name corrected this. –  Oct 14 '17 at 17:34
  • 1
    Be sure **not** to have your app running (as a Mac app; possibly true for iOS, too) or else your target won't get renamed and your face will explode. – Clifton Labrum Oct 31 '17 at 17:35
  • 4
    This is a lot of hoops to jump through just to rename a project. It shouldn't be this complicated. – gloo Dec 25 '17 at 07:14
  • 2
    The comment by @AaronAsh was very useful, though I made the mistake of doing `git mv oldname newname` in *addition* to Step 3.2. I believe it should be done *instead* of Step 3.2. (The command takes care of the renaming.) – Rogare Jan 26 '18 at 16:28
  • 3.2 `wrongly named OLD folder.` - it can be more folders (test folders), should also rename test swift files? – user924 Feb 08 '18 at 09:33
  • 1
    `Xcode 9.2`: *Step 3.2: In the correctly named master folder* -- The master folder still had the old name, so I used a Terminal window to rename it: ` $ mv oldname newname`, then I cd'ed into the master folder and used git to rename the inner folder: `git mv oldname/ newname/`. Step 3.3: I got an "Assets.xcassets" popup warning, which I dismissed. At the very end, I got a warning about a missing launch image. I double clicked the warning, and Xcode installed the image for me. Now, I have some png image directly under the project name in the Project Navigator. – 7stud Mar 05 '18 at 10:03
  • 2
    Brilliant! As also written by @Vaiden , if you have bridging headers, you have to update the directory of these header to the new one. You have to change the setting "Objective-c Bridging Header" under "Build settings" – DSoldo Mar 12 '18 at 14:51
  • 1
    "Step 1 : On the right select the "File inspector" ..." I can not find the "File inspector", xcode 9.2 – Ahmed Eid Apr 09 '18 at 07:55
  • 2
    If you are using pods please also see @Vaiden answer and don't open XXX.xcworkspace to change the name! Open XXX.xcodeproj file. – Shuvo Joseph Apr 10 '18 at 07:15
  • 3
    In Xcode 9, you can do step 3 (renaming the folder) from Xcode itself as it now links groups with the actual folders – Jonathan Cabrera Apr 25 '18 at 16:10
  • 2
    Step 3.6 happens automatically for me. –  Jul 11 '18 at 02:21
  • Getting Entitlements error? Go to Target > Capabilities and Enable Push Notifications, (wait, look at status), then disable. This should rebuild Entitlements. – Chewie The Chorkie Feb 11 '19 at 20:54
  • 2
    In step 4.2 ('search for plist'), I had to make sure my 'target' (i.e, not my 'project') was selected in the pane at the left side of the main window (right of the project navigator) before searching for plist. – gOnZo May 28 '19 at 12:41
  • 2
    In XCode 10.2.1 I had to update `OLD.entitlements` to the new name under the key `CODE_SIGN_ENTITLEMENTS` in `Build Settings` – Mayas Jun 17 '19 at 09:22
  • I had "Build input file cannot be found" for info.plist - To fix it, go to the target, not the project and general tab and under identity reselect the info.plist file – Schwarz Software Jun 26 '19 at 03:38
  • After step 3.5/3.6, the root folder was pointing to the right location, but the direct subfolders weren't. For those I had to do the same as step 3.6, and choosing the new location. – Jeroen Jan 10 '20 at 09:14
  • This is correct, but if you accidentally miss one of the steps and can't get it to work just show the package contents of your project file and open the internal files in a text editor and find/replace your old/new project names. Also had to do this inside the core data model. This worked fine for me. – Jonathan Feb 25 '20 at 04:36
  • I'll bet most of your rep is from that one answer –  May 17 '20 at 18:50
  • 1
    Step 3 Point 4: Please add a note that all the files should be closed before the change. – Lachezar Todorov Oct 09 '20 at 17:31
  • 1
    **ENGLISH LETTERS ONLY** Because I had bugs with Ukrainian names – J A S K I E R Jun 03 '21 at 14:50
  • For Step 4.7, the DEVELOPMENT_ASSETS was in the app target, not the project settings. – Patrick Aug 06 '21 at 18:25
  • well Xcode crashes everytime I change the project name – rickrvo Jun 22 '22 at 20:20
  • Finally, it helps to do a "Find All" across your project in XCode (Find > Find in Project in the menu or `Cmd` + `Shift` + `F`). Search for your old project name, in order to see if you missed any spots. – nishanthshanmugham Jul 10 '22 at 04:13
  • If you're using StoreKit configuration file (`.storekit`), don't forget to update the path to it as well in your scheme. Click on your app scheme > "Edit Scheme..." and you may see the red file name in "StoreKit Configuration" field. Just click on it and select another file, that will update the path. – Randex Sep 24 '22 at 09:30
  • In case you are using Storyboards, in the "Build Settings" also make sure to update `IBSC_MODULE` (Default Module). This is especially useful for watchOS App targets, as this is set to the App Extension module name (in iOS apps `IBSC_MODULE` can be left empty and will automatically point to the target's module). – davidisdk Feb 02 '23 at 09:14
234

To add to luke-west's excellent answer:

When using CocoaPods

After step 2:

  1. Quit Xcode.
  2. In the master folder, rename OLD.xcworkspace to NEW.xcworkspace.

After step 4:

  1. In Xcode: choose and edit Podfile from the project navigator. You should see a target clause with the OLD name. Change it to NEW.
  2. Quit Xcode.
  3. In the project folder, delete the OLD.podspec file.
  4. rm -rf Pods/
  5. Run pod install.
  6. Open Xcode.
  7. Click on your project name in the project navigator.
  8. In the main pane, switch to the Build Phases tab.
  9. Under Link Binary With Libraries, look for libPods-OLD.a and delete it.
  10. If you have an objective-c Bridging header go to Build settings and change the location of the header from OLD/OLD-Bridging-Header.h to NEW/NEW-Bridging-Header.h
  11. Clean and run.
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Vaiden
  • 15,728
  • 7
  • 61
  • 91
  • 7
    Using Xcode 8.3.2 I had to use cocoapods-deintegrate and reinstall all pods to run the project with the new name. – SteffenK Jun 01 '17 at 23:42
  • 2
    @SteffenK is there a differemce between that method and rm -rf Pods/ ? Considering that you've done all the other steps? – Vaiden Jun 03 '17 at 17:17
  • Yes, there are some traces remaining that caused my project to crash after the name change. cocoapods-deintegrate will remove them. – SteffenK Jun 03 '17 at 21:36
  • 1
    Would you elaborate please? What traces? – Vaiden Jun 03 '17 at 21:38
  • 2
    @Vaiden thank you so much for the extra clarity when working with CocoaPods! The process did create a second reference, which was strange, but after removing it everything was working perfectly! Thanks again! :) – JDev Jun 12 '17 at 14:09
  • Thanks, I had to do 1 more step. Click on your project name in the project navigator -> Under General Tab -> Under Identity (a new drop down appeared) -> browse and select my info.plist file -> Done – mustaq Jun 15 '17 at 06:38
  • @mustaq is this related to Cocoapods or just a general step that needs to be taken? – Vaiden Jun 15 '17 at 08:27
  • 6
    Could somebody tell me where I can find the OLD.podspec file that is mentioned in this answer? In my project I got a few files like 'Podfile'/'Podfile.lock'/'Pods.xcodeproj' and I got an empty folder named 'Local Podspecs', but I cannot find an .podspec file – codeDude Aug 22 '17 at 10:42
  • 4
    You only need a podspec file when you are distributing/planning to distribute your project as a Cocoapod. If you did that, you'd likely know, so I suppose you have no podspec, @codeDude – Jan Nash Jan 23 '18 at 11:01
  • Thank you so much. Step 9 for "After Step 4" is golden. – Samman Bikram Thapa Mar 24 '18 at 04:57
  • @Vaiden I have not found libPods-OLD.a file in my build phases, Please let me know how can I find it and remove it. – Vivek Oct 15 '18 at 10:57
  • @Vivek - it's not actually named libPods-OLD.a. It's named libPods-{the_original_project_name}.a – Vaiden Oct 15 '18 at 16:47
  • @Vaiden I have not found libPods-{the_original_project_name}.a even not found any file/framework extension with .a, what should I do ? – Vivek Oct 16 '18 at 10:03
  • When renaming a WatchKit project, you need to rename the plists for the Watch App and WatchApp Extension. Still there is a problem. Project gets an error failing to instantiate the initial view controller on the watch. All the names appear to be correct, but No Go. – BlueskyMed Jan 30 '19 at 12:24
  • 1
    For XCode 11 beta with SwiftUI there is an additional field in the Build Settings called "Development Assets" which will need to fixed also. – tdl Jul 03 '19 at 16:59
80

Xcode 11.0+.

It's really simple now. Just go to Project Navigator, the left panel of the Xcode window. Press Enter to make it active for rename, just like you change the folder name.

Enter image description here

Just change the new name here, and Xcode will ask you for renaming other pieces of stuff.

Enter image description here.

Tap on Rename here and you are done.

If you are confused about your root folder name, like why it's not changed, well it's just a folder. It is just renamed it with a new name.

Enter image description here

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Kiran Jasvanee
  • 6,362
  • 1
  • 36
  • 52
  • When I try to rename it says "Couldn't rename" – bikram Jun 19 '20 at 06:15
  • @bikram might be some obstacle while refactoring the project name. can't figure out without checking the actual project in hand. normally it works fine every time. – Kiran Jasvanee Sep 06 '20 at 07:34
  • @KiranJasvanee the build fails when I rename the root directory. But it succeeds when I keep it as its old name. Everything else works fine though. – alec wilson Nov 21 '20 at 23:49
  • You might also have to point your target(s) to the new info.plist location. – Gabriel Jensen Mar 29 '21 at 20:53
  • 2
    This "simple" solution failed miserably for me. It moved files to the wrong places, deleted others, failed to change many settings. I had to go in by hand and fix all the issues. NOT RECOMMENDED. – Womble Jul 08 '21 at 06:22
  • 1
    After procedure above you **MUST** change address of the **Info.plist**: Project Navigator in left pane > choose project > Build Settings > Packing > Info.plist File > rename to NEW PROJECT NAME/Info.plist – Mamad Farrahi May 19 '22 at 09:40
76

A quicker solution using shell commands (works with CocoaPods too):

Please cd to a non-Git repository before proceeding ⚠️

Step 1 - Prerequisites

  1. Copy your original project folder to a temporary /NewProjectFolder Outside your Git repository. ⚠️ changes to .git could corrupt your git index

Step 2 - Open Terminal

Now we're going to rename the project from oldName to NewProject.

  • Close Xcode.

  • Go to your /NewProjectFolder.

      cd /Path/to/your/NewProjectFolder
    
  • Install the extra tools needed.

      brew install rename ack
    
  • Rename the files and directories containing the source string. You’ll need to run this command twice, because directories will be renamed first, then files and directories inside those will be renamed on the next iteration.

      find . -name 'oldName*' -print0 | xargs -0 rename --subst-all 'oldName' 'NewProject'
    
  • Check if all the files containing the source string are renamed. You should see empty output.

      find . -name 'oldName*'
    
  • Replace all occurrences of the string in all files.

      ack --literal --files-with-matches 'oldName' --print0 | xargs -0 sed -i '' 's/oldName/NewProject/g'
    
  • Check if all occurrences of the string in all files were replaced. You should see empty output.

      ack --literal 'oldName'
    
  • Run pod install

  • Add NewProjectFolder to your repository.

  • You are done!

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Pietro Basso
  • 1,403
  • 11
  • 11
  • 4
    Thanks for this I found it useful. When copying and pasting commands like this I prefer it if the work can be minimised so an example name of "YourNewAmazingProjectName" is overkill, just use "example" as it prolongs the life of my delete key. – LpLrich Jan 29 '18 at 14:56
  • 2
    @LpLrich thank you for your suggestion, I've just updated my answer. – Pietro Basso Jan 30 '18 at 08:57
  • The main folder was renamed but I'm not seeing any other directories or files renamed, any suggestions? – Ethan Parker Jul 03 '18 at 21:13
  • 4
    @EthanParker you need to run `find . -name 'oldName*' -print0 | xargs -0 rename --subst-all 'oldName' 'ExampleName'` twice, files and directories inside the main folders will be renamed on the second iteration. – Pietro Basso Jul 05 '18 at 08:24
  • The issue was that I didn't remove .git before I ran the commands, they don't work if it's an active git repo. – Ethan Parker Jul 05 '18 at 20:20
  • one thing extra i had to do was remove the 'Pods_oldName.framework' from my project's target > general > Linked frameworks and libraries section to get rid of the error `framework not found Pods_oldName clang: error: linker command failed with exit code 1 (use -v to see invocation)` – nommer Jul 19 '18 at 00:30
  • 1
    I used coreData in my project and i had to run this command not twice but three times. – ShadeToD Mar 03 '19 at 15:21
  • In order to change the case (from 'MyApp' to 'Myapp'), I needed to transition between a temporary name (from 'MyApp' to 'TempName' and finally to 'Myapp'). As mentioned by @ShadeToD, Core Data required to execute the command 3 times. For this case correction, I had to delete the certificate in Apple Developer Center before creating a new one, even if bundle IDs should by all means be case sensitive. Finally, I could not delete the CloudKit container with the initial case format, and could not create a new one with the new one, so I caved and added something to the new CloudKit container name. – cdf1982 May 31 '20 at 05:43
38

There is a GitHub project called Xcode Project Renamer:

It should be executed from inside root of Xcode project directory and called with two string parameters: $OLD_PROJECT_NAME & $NEW_PROJECT_NAME

Script goes through all the files and directories recursively, including Xcode project or workspace file and replaces all occurrences of $OLD_PROJECT_NAME string with $NEW_PROJECT_NAME string (both in each file's name and content).

Don't forget to backup your project!

Xcode Project Renamer

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Olcay Ertaş
  • 5,987
  • 8
  • 76
  • 112
10

Extra instructions when following @Luke-West's + @Vaiden's solutions:

  • If your scheme has not changed (still showing my mac) on the top left next to the stop button:
  1. Click NEWLY created Project name (next to stop button) > Click Edit Schemes > Build (left hand side) > Remove the old target (will say it's missing) and replace with the NEWLY named project under NEWLY named project logo

Also, I did not have to use step 3 of @Vaiden's solution. Just running rm -rf Pods/ in terminal got rid of all old pod files

I also did not have to use step 9 in @Vaiden's solution, instead I just removed the OLD project named framework under Link Binary Libraries (the NEWLY named framework was already there)

So the updated steps would be as follows:

Step 1 - Rename the project

  1. If you are using cocoapods in your project, close the workspace, and open the XCode project for these steps.
  2. Click on the project you want to rename in the "Project navigator" on the left of the Xcode view.
  3. On the right select the "File inspector" and the name of your project should be in there under "Identity and Type", change it to the new name.
  4. Click "Rename" in a dropdown menu

Step 2 - Rename the Scheme

  1. In the top bar (near "Stop" button), there is a scheme for your OLD product, click on it, then go to "Manage schemes"
  2. Click on the OLD name in the scheme, and it will become editable, change the name
  3. Quit XCode.
  4. In the master folder, rename OLD.xcworkspace to NEW.xcworkspace.

Step 3 - Rename the folder with your assets

  1. Quit Xcode
  2. In the correctly named master folder, there is a newly named xcodeproj file with the the wrongly named OLD folder. Rename the OLD folder to your new name
  3. Reopen the project, you will see a warning: "The folder OLD does not exist", dismiss the warning
  4. In the "Project navigator" on the left, click the top level OLD folder name
  5. In Utilities pane under "Identity and type" you will see the "Name" entry, change this from the OLD to the new name
  6. Just below there is a "Location" entry. Click on a folder with the OLD name and chose the newly renamed folder

Step 4 - Rename the Build plist data

  1. Click on the project in the "Project navigator" on the left, in the main panel select "Build Settings"
  2. Search for "plist" in this section Under packaging, you will see Info.plist, and Product bundle identifier
  3. Rename the top entry in Info.plist
  4. Do the same for Product Identifier

Step 5 Handling Podfile

  1. In XCode: choose and edit Podfile from the project navigator. You should see a target clause with the OLD name. Change it to NEW.
  2. Quit XCode.
  3. In terminal, cd into project directory, then: pod deintegrate
  4. Run pod install.
  5. Open XCode.
  6. Click on your project name in the project navigator.
  7. In the main pane, switch to the Build Phases tab. Under Link Binary With Libraries, look for the OLD framework and remove it (should say it is missing) The NEWLY named framework should already be there, if not use the "+" button at the bottom of the window to add it
  8. If you have an objective-c Bridging header go to Build settings and change the location of the header from OLD/OLD-Bridging-Header.h to NEW/NEW-Bridging-Header.h
  9. Clean and run.

You should be able to build with no errors after you have followed all of the steps successfully

Fattie
  • 27,874
  • 70
  • 431
  • 719
itsmcgh
  • 783
  • 1
  • 9
  • 12
  • 5
    For Step 5.3 instead of `rm-rf Pods/` a cleaner way is to run `pod deintegrate` which removes all traces of CocoaPods from your Xcode project but leaves your Podfile intact. – jklapwyk Jan 02 '19 at 20:47
  • This rules. It provided the foundation for me to merge an Ionic app with an existing iOS app. – t4l Apr 28 '20 at 04:33
  • You really should recommend `pod deintegrate` as a safer alternative to `rm -rf Pods`. It's only a space away from being a disaster. – DBrown Jan 15 '21 at 20:00
8

To change the project name;

  1. Select your project in the Project navigator.

  2. In the Identity and Type section of the File inspector, enter a new name into the Name field.

  3. Press Return.

    A dialog is displayed, listing the items in your project that can be renamed. The dialog includes a preview of how the items will appear after the change.

  4. To selectively rename items, disable the checkboxes for any items you don’t want to rename. To rename only your app, leave the app selected and deselect all other items.

  5. Press "Rename"

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Paal Aune
  • 353
  • 5
  • 10
2

Aside from all the steps Luke and Vaiden recommended, I also had to rename all the customModule properties in my Storyboard to match the new name, and this has to be case sensitive.

CristianMoisei
  • 2,071
  • 2
  • 22
  • 28
  • 1
    the only person who has ever mentioned this! – Fattie Nov 20 '19 at 16:27
  • 1
    NOTE you can do this IN INTERFACE BUILDER, by just sort of "re-clicking" on the field. It will then correctly "re-default" to your new project name. – Fattie Nov 20 '19 at 16:29
2

Adding to the accepted answer by Luke West. If you have any entitlements:

  1. Close Xcode
  2. Change the entitlements filename
  3. Go into Xcode, select the entitlements file should be highlighted red, in the File inspector select the Folder icon and select your renamed file.
  4. Go into Build Settings, and search "entitlements" and update the folder name and file name for the entitlement.
  5. Clean and rebuild
Alexander
  • 1,424
  • 18
  • 23
  • I faced following issue after following steps given by you, Verify the value of the CODE_SIGN_ENTITLEMENTS build setting for target "Smartify" is correct and that the file exists on disk. – Protocol Oct 29 '20 at 13:07
  • 1
    Double check the that Build Settings is pointing to the correct location for the Entitlements file. Clean and rebuild – Alexander Oct 29 '20 at 15:21
0

One more thing to note that I don't think has been noted yet is if you are using CoreData objects along with a lazy persistentContainer in the AppDelegate file (or anywhere else), you may get an error saying NSManagedObjectContext is nil (or something along those lines). Change the name for any NSPersistentContainer to use the NEW app name. That should fix the issue! If not, according to this old SO post the solution is to delete your old .xcdatamodeld file and create a new one adding back all the entities again.

0

I find helpful few simple steps I found on web:

  1. in Finder change project's folder name
  2. open project/select project file in Xcode navigator/show the file inspector/under Identity and Type change Name as per your preference/Enter/wait few seconds till pop-up window appears/click rename/again wait few seconds - do not push OK/
  3. select folder under project file in Xcode navigator/show the file inspector/under Identity and Type change name as per your preference/Enter/wait few secont till file under project file in Xcode nagivator changes its name
  4. in Xcode project status bar click on the project name (it appears when you hover over the beginning of line)/choose Manage schemes...till "Autocreate schemes" window shows up/2x click on project name under scheme column/enter/close "Autocreate schemes" window
  5. select project file in Xcode navigator/inXcode editor ~ interface builder area choose tab "Build setting"/in filter type the previous name of your project/click enter/in the line(s) where the previous name of your project appears within the root(s) - just change it to new name
  6. voala that's it
mairo
  • 155
  • 8
0

If its react native what you can do is: You can change the name attribute in package.json, run react-native upgrade, and just let react overwrite the android/ios files. Don't overwrite your index files if there is unsaved code, however.