Mac OS X Platform and Software Development and Tips & Tricks and Workflow Tobi on 10 Apr 2008 12:40 pm
Xcode — Rename Project and Application, Change Copyright and Version Number
After reading the first 6 chapters in Aarons book, I couldn’t wait any longer and had to start writing my own program. I will share a first taste of it here soon. One key problem I soon faced was how to manage multiple versions, i.e., how to save old versions of my program when making major changes. Xcode has no rename functionality, and since an Xcode project comprises many files, the answer is not straightforward. A related problem is that I first started to call my Cocoa Application project by appending the version number. The problem with that is that the Cocoa application by default has the same name and that was awkward. For instance, my current project, a fractal generator, is called “FracGen 0p3″, but I wanted the application to be called only “FracGen” and have the version number appear when selecting the “About” menu item.
To rename an Xcode 2.5 project, do the following:
- Close the project in Xcode
- Duplicate the project directory in the Finder by pressing Command-D.
- Rename the folder
- Open the folder and rename the “.xcodeproject” file
- Delete the “Build” sub folder, if there is one
- Open the renamed .xcodeproject file
- On the left in the “Groups&Files” list, expand the “Targets” group, double click on the target that still has your old project filename. Rename it under the “General”-tab in the window that opens.
- Select “Clean all targets” from the “Build” menu, keep the boxes checked, and click “Clean”.
- Build and run your project.
Now about the second problem:
- In Xcode, on the left in the “Groups&Files” list, expand the “Resources” group, and click on “Info.plist”. In the editor on the right you’ll see a lot of entries of this plist file.
- Go down to the “CFBundleVersion”-entry and enter your version number, e.g., “0.3″
- Next, on the left select “InfoPlist.strings”. In the editor on the right, you’ll see an entry for “NSHumanReadableCopyright”. Enter your information between the quotes, e.g., “(c) Toby Junker, 2008″
- Finally, double-click your target (the one you renamed above), select the “Build”-tab in the window that opens, and scroll down until you find “Product Name”. This will have the original name of your “Xcode Project” (before you renamed it). Choose a name w/o version number, e.g., “FracGen”. You will not have to change this again.
These steps sound rather daunting, but are actually very quick to do. I have not yet switched to Leopard, so I don’t know if they work in Xcode 3.0, of if Xcode 3.0 finally has a rename function. The steps given to rename a project have to be executed every time you want to create a new version of your project. The application name and copyright info has to be changed only once. if you want the version to show up correctly in the application’s “About” box, you’ll have to change the plist as explained above.
on 24 Jun 2008 at 12:53 # Ruedi Heimlicher
I followed the above List of action an got strange results. The first project was renamed without problems.
In another project, I changed also the entry in the info.plist for the key CFBundleExecutable
The Target and the app in Finder was renamed correctly.
But when I change the Product Name (4. of the second problem), I get an error: Exited with error 5.
Naming the Product Name back to the original solves the problem and gives me a renamed app and Project.
Something I am doing wruong, but what?
Thanks.
Ruedi Heimlicher
on 31 Aug 2008 at 15:56 # John Beatty
In Xcode 3.1, in addition to the steps described above for the first problem:
(1) Rename the *_Prefix.pch file as well as the xcodeproj file.
(2) Having double-clicked on the target to open up the info window, click on the Build tab and change the Product Name and Prefix Header values. [You can either scroll until you see them - they're in bold - or you can search for the old project name.] You’ll want to do this for both the debug and release configurations.
That sufficed for me – YMMV, of course…
-jcb
on 04 Nov 2008 at 7:54 # Martin Michel
Thank you very much! Following the instructions on this website I was able to successfully rename my Xcode project! Next time I will think two seconds more about the project name before starting to code
Best regards from Germany,
Martin
on 17 Dec 2008 at 12:52 # mohrt
Here is a method I used, works like a charm:
http://mohrt.blogspot.com/2008/12/renaming-xcode-project.html
on 26 Feb 2009 at 11:48 # Rich
I renamed my project using the method above…adding the extra steps for 3.1 and it runs…however, the name in the Apple bar at the top of the screen still shows the original project name! How can I change that?
on 28 Apr 2009 at 15:36 # Marco Papa
One more thing that needs to be done in Xcode 3.1.2:
Change GCC_PREFIX_HEADER to your new Prefix header
on 22 May 2009 at 5:41 # Eamon
Brilliant. I spent hours previously trying to get this done and your checklist (plus jcb’s advice) took me all of 4 minutes to get right.
on 25 May 2009 at 8:15 # Ant1 Vanden
If you are trying to change the name of the final product (the app) you should simply open the info panel on your app in the target section of your app, then click on the show drop down and select settings defined at this level and there will be a section written product name double click on it and change the name of the app!
on 30 Jun 2009 at 15:13 # Mark Lorenz
I’ve had luck changing the installed file name (the name the user sees) in iPhone development by:
Projects>Edit Active Target
and changing the entry for “Product Name” under the “Settings” heading.
on 03 Aug 2009 at 12:09 # Devi
Its very nice and easy to proceed… Good one
on 15 Aug 2009 at 1:51 # Alberto Cobas
XCode 3.2 makes renaming a project a trivial task. Just select the Project entry in the Groups & Files panel, then select the menu Project -> Rename… In the dialog that comes up you have the option to make a snapshot before the rename itself takes place. Worked like a charm on the first try
on 13 Dec 2009 at 17:00 # petem
alberto: Could you please identify the “Project” entry better. Do you mean under “Targets”? Or the very top level entry in the left hand panel?