The Blog

How to rename project in Xcode 3.x

I thought this would be a simple thing to do, but apparently not.
There’s no option to copy the state of the project as it is and continue working on it under the new name. The reason I need this is that I’m going through AAron Hillegass’s Cocoa Programming for Mac OS X, 3rd ed. and some of the projects span several chapters, each introducing new concepts. Thus I wanted to have each in the state it was at the end of the chapter, than compare and analyze the differences, to better understand what’s new and improved.

Since no option, we go with manual work.

  1. Copy/rename the folder into new name
  2. Get inside the new folder and rename the .pch and .xcodeproj files
  3. Delete the build folder
  4. Open .xcodeproj file in text editor, like TextMate or TextWrangler. That’s actually a folder, which contains 4 files (you can also right-click and do Show package contents, which will reveal the files)
  5. Open project.pbxproj in text editor and replace all instances of the old name with the new name
  6. Load the project file in XCode, do Build/Clean all targets

Now it should be ready for new build, under new name.

Update (Nov 28, ’10): now there is a simple path: copy into a different folder, open the project and then in Xcode pick Project/Rename menu item. If that fails, there’s always a manual way above.

Banca

Banca

Beautiful and functional currency converter, supports just about any currency in the world.

Go Couch to 5k

Go Couch to 5k

The most popular starter running program in beautiful feature-rich app (GPS tracking, charts, detailed history etc)

Quickie to do

Quickie to do

The fastest short-term task-list / check-list app on the App Store. Really.

Guerrilla Cardio

Guerrilla Cardio

The most challenging high-impulse interval training in the world.

Run Mate

Run Mate

A versatile running coach app, with unlimited number of running programs. Perfect for casual runners.

21 Comments

Feel free to chime in, looking forward to it. Leave a Comment

  1. Jason Green says:

    Thanks! This was easy enough, but I was trying to find a “supported” way to do it :) I wasted too much time on that!

  2. chumbawumba says:

    thanks man i was looking for a solution, and this seems to be the easiest one around :)

    im also following the same book as you…

  3. Will Culpepper says:

    Don’t forget to open your .xib files with a text editor and do a search/replace there as well.

    Also rename your class files and all references inside them to be safe.

  4. Thanks for this! It didnt work at first, so I just opened all class files and xib files and did a Cmd +F and choose to replace all old text with new, it worked great!

  5. Sean Barenz says:

    Thanks for the post. It was a huge help

  6. Tom Jennings says:

    Aleksandar, thanks for your post.

    I found that I did not have to change the .pch file name … in fact if I did , the program crashed. I left it alone and everything seems to work fine.

  7. muz says:

    Good jooob…
    just to mention few points:
    1. Its better if you first refactor the name of your delegate through xcode to new name delgate.
    2. the name of header files do not get refactored u have to do those manually.
    3. you have to rename plist, pch.
    4. search in your project with old name in xcode and replace with new name carefully.

  8. N.B. says:

    That helped a lot!, thanks!

  9. Manjunath HS says:

    Instead we can create a different target and keep all versions in same project isn’t it?

  10. Paul says:

    Thanks. This post was very useful. I hope this feature gets supported in the next releases of Xcode. :)

  11. Carl Grainger says:

    Now you’ve tried the hard way, try this:

    In Xcode menu go to Project and select Rename.

    That’s all Folks

  12. Boon says:

    I have listed the steps I normally use and you don’t have to deal with the xcodeproj file directly:

    http://www.nanaimostudio.com/blog/2010/2/15/renaming-project-in-xcode-the-simple-way.html

  13. abizer says:

    Rather than create a slew of projects with differing names, this would have been a good chance to learn about using a source code repository. It makes comparing different states of a project much easier.

  14. Thanks! Saved me some digging under the hood. Would just like to add that in the case of my iPhone app, I had to also rename the app delegate source files (*AppDelegate.h, and .m).

    Also, if you want to give spaces in your project name, note that you can have spaces in the folder name and .xcodeproj name. In all other filenames, you need to put in underscores instead of spaces.

  15. Thanks for putting this out there. Was a big help. Instructions are similar for AppleScript, just change source code file (instead of .sch use .applescript). I went ahead and replaced all with in the .xcodeproj package. –Michael

  16. Sam Brodkin says:

    Aleksandar, I used your updated (simple) method and I was done in 20 seconds. Thanks!

  17. NB says:

    I was breaking my head over this, till I read about the Simple Way.Thanks

Trackbacks for this post

  1. Doug Diego » How To Rename an iPhone XCode Project
  2. xocolatl. » Blog Archive » Working with Sample Code: Rename your project in Xcode 3.x
  3. How to rename project in Xcode 3.x | published @ aplus moments | Connor Denman's Blog

Comments are now closed for this article.