Renaming a Project in XCode

 
 

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
a) Make the target MyWOProject active.
b) Select Edit Active Target ‘MyWOProject’ from the Project menu.
c) Under Target Summary pane, enter ‘MyNewWOProject’ in Base product name.
d) Under Info.plist Entries/Expert View, change the project name for NSExecutable and NSJavaPathClient properties.
e) In the Groups & Files project pane, expand targets
f) 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.

Directory iPublicSpeaker -> PublicSpeech

File iPublicSpeaker.xcodeproj -> PublicSpeech.xcodeproj

Select iPublicSpeaker target and select Rename from the File menu

Choose Clean All Targets from the Build menu

cd /users/khanhnt/documents/publicspeech/publicspeech.xcodeproj

ls –al

vi project.pbxproj

:%s/iPublicSpeaker/PublicSpeech/g

File iPublicSpeaker_prefix.pch -> PublicSpeech_prefix.pch

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: