Renaming an Xcode project or executable.
If you have used Xcode before you know that when you create a new project the name you give the project is used as the name for the target executable. But what do you do if you come up with a new name for your application or want to create a similar project with some minor changes. Well you have two choices.
1. Rename the entire project.
2. Rename only the executable.
Update: XCode 3.2.3 now provides a built in rename. Open the project you want to rename in Xcode then under Projects select rename.
Renaming a project in Xcode 3.x
This seems like it ought to be a simple process provided by Xcode but it is not. Here is how to do it.
1. Copy and rename the project folder
2. Inside the new project folder rename the files ending in .pch and .xcodeproj
3. Right click on .xcodeproj file (it is actually a folder) and select show contents. In the contents folder there should be a file ending in .pbxproj. Open This file in you favorite editor and replace all instances of the old project name with the new project name.
4. Delete the build folder
5. Open the Renamed Xcode project and right click (Control click) on the Target from the groups and files list. Select Info to open the properties panel.
6. Click on the build tab the select packaging from the collection pop up menu
7. Change the value in the product name build setting to the new name.
8. Do Build Clean all Targets.
Changing the executable name
1. Open the Xcode project and right click (Control click) on the Target from the groups and files list. Select Info to open the properties panel.
2. Click on the build tab the select packaging from the collection pop up menu
3. Change the value in the product name build setting to the new name.
4. Do Build Clean all Targets.


4 Responses
How to Rename an Appthe @ Dr. Touch - June 30, 2009
[...] If you have changed all the names, all the files, all the Xibs and still cannot build successfully then my friend it’s time for the “brute force pro fix” which I found on Tom’s Cocoa Blog. [...]
Thanks. But it’s baffling to me why such a seemingly important function has to require such pains. Doesn’t anyone at Apple rename projects?
Now that XCode 4 is about to obviate so much of the advice about this topic, my solution was as follows:
1. Make a new empty project with the desired name.
2. Open my old incorrectly-named project in another window.
3. Rename the AppDelegate of the new project to match the delegate in the old project. I only do this because the AppDelegate tends to have an over-long name (though I understand why it makes sense). I generally refer to my AppDelegate as [NSApp delegate].
4. Import all the files from my previous project into the new one (with copy selected).
The project I did this for is pretty small. I have no sense of whether this scales for a large project. Sure would be nice if it was just a menu option.
Thank you SO much! This was very useful for renaming a project. I had followed another tutorial and they had left out the part about the .pbxproj file changes. When I tried to compile for Ad Hoc distribution I kept seeing references to my old project name. (although debug worked fine!)
One thing I’d like to add is if your new project name has a space in it, when editing that .pbxproj file there are some spots where variables within that file are set to equal the new project name and you will need to wrap the name in quotes. for example
path = “My New Name-Info.plist”
name = “My New Name”
etc…
Looks like the second part (renaming the executable) no longer works in Xcode 3.2.3. The executable that is created is still the old name.
Leave a Reply