docs:programming:xcode:renaming_projects

Renaming Projects in Xcode

  1. duplicate the OldProject folder
  2. rename the new project folder to NewProject
  3. rename the OldProject.xcodeproj to NewProject.xcodeproj
  4. open NewProject.xcodeproj in Xcode
  5. rename the target OldProject to NewProject
  6. open the info panel for the target
    • in the Properties tab, change the identifier if necessary
  7. Clean all
  8. close Xcode, and edit NewProject.xcodeproj/project.pbxproj in a text editor
    • replace every OldProject reference with NewProject
  9. rename OldProject_Prefix.pch to NewProject_Prefix.pch (if it exists)
  10. edit NewProject_Prefix.pch in a text editor
    • replace every OldProject reference with NewProject
  11. open Xcode, and build and run your application
  12. (Optional) you may need to update the following files if you have them, or if you have modified them
    • InfoPlist.strings
    • Credits.html
    • Credits.rtf
    • also, any icons or graphics with outdated images such as old program names

These instructions are adapted from the Apple instructions for the same task using Project Builder . Renaming a project in XCode is a bit convoluted, however it only takes a few minutes and is certainly quicker than recreating the project from scratch in my opinion. Here is how …

Assume you are starting with a project named “MyWOProject” and that you want to change its name to “MyNewWOProject”.

  1. Duplicate the “MyWOProject” directory and name it “MyNewWOProject”.
  2. Rename the MyWOProject.xcode file inside the MyNewWOProject directory to MyNewWOProject.xcode.
  3. Open the MyNewWOProject project in Project Builder.
  4. Rename the MyWOProject target MyNewWOProject
    1. Make the target MyWOProject active.
    2. Select Edit Active Target 'MyWOProject' from the Project menu.
    3. Under Target Summary pane, enter 'MyNewWOProject' in Base product name.
    4. Under Info.plist Entries/Expert View, change the project name for NSExecutable and NSJavaPathClient properties.
    5. In the Groups & Files project pane, expand targets
    6. Select MyWOProject target and select Rename from the File menu
  5. Choose Clean All Targets from the Build menu.
    • At this point, if you build the project, the file still has the name MyWOProject, as does the .woa directory and the URL for connecting to the application. A few more steps are necessary to complete the process.
  6. Quit XCode.
  7. Open a terminal window, and navigate (using 'cd') INTO the project (which is a unix package directory). For example…
    % cd /Users/kieran/MyNewWOProject/MyNewWOProject.xcode
    
    List the contents with
    % ls -al
    
    Open the file project.pbxproj with a text editor (such as vi for example , as I do here)...
    % vi project.pbxproj
  8. In vi, replace all occurrences of MyWOProject with MyNewWOProject by pressing the colon key ( : ) (the colon key initiates the vi command line) and then type %s/MyWOProject/MyNewWOProject/g. So you literally type these characters (replacing with your old and new project names of course)
    :%s/MyWOProject/MyNewWOProject/g
    
    Save and exit vi by typing literally a colon, the letters 'w' and 'q'...
    :wq
  9. Open MyNewWOProject in XCode.
  10. Build and run the application.
  • docs/programming/xcode/renaming_projects.txt
  • Last modified: 2008/08/03 00:25
  • by 127.0.0.1