Manually Removing Resource from XCode Project file

In trying to add a file to an XCode project, I somehow inadvertently added the whole hard drive ("/") as a group to the project(!).  This got things busy, as XCode started trying to populate the treeview in the IDE, and was basically unresponsive to any desperate clicks I shot at it to try to cancel.

After manually killing the XCode process from a terminal, I was able to get myself out of this by editing
the file project.pbxproj that's in the project directory.  To be specific, if your XCode project is named fooproject, then this file will probably be in the fooproject/fooproject.xcodeproj directory.

In my case, the original silly mistake resulted in the following entries in the "PBXBuildFile" and "PBXFileReference" sections of the file project.pbxproj:

PBXBuildFile section:
9F1FFAC7156096ED00DD6F07 /* / in Resources */ = {isa = PBXBuildFile; fileRef = 9F1FFAC6156096ED00DD6F07 /* / */; };

PBXFileReference section:
9F1FFAC6156096ED00DD6F07 /* / */ = {isa = PBXFileReference; lastKnownFileType = folder; name = /; path = ../../../../..; sourceTree = "<group>"; };

I deleted these lines in vi, reopened the project in XCode, and things were fine.

Of course, if you are going to try this, make sure and make a backup copy of the project.pbxproj file first before mucking with it. Or better yet, don't do something that results in you contemplating the editing of this file.

Popular Posts