How can I delete an Xcode workspace?

6k views Asked by At

I've got an Xcode project, in an Xcode workspace. At one point, I thought I wanted a workspace, so I added one, but it turns out I'm not doing anything which can benefit from that, and I'd rather not have that extra layer of complexity.

How can I delete the workspace, so I have just a plain project again?

I found some web pages that say a workspace is just a set of pointers to projects, but there also must be pointers back from the project to the workspace. When I try deleting the .xcworkspace directory, I get build errors with the project (files in the workspace not found).

2

There are 2 answers

0
WhatsUpNSDoc On

I think I figured out the trick. For project "Foo" in workspace "Bar":

  • Delete the Bar.xcworkspace directory
  • Delete the Foo.xcodeproj/project.xcworkspace/xcuserdata/myname.xcuserdatad/UserInterfaceState.xcuserstate file
  • In Foo.xcodeproj/project.pbxproj, delete the "PBXContainerItemProxy" section
0
SteveS On

I used this procedure for XCode 12.4, April 2021

  1. Close XCode
  2. Delete the main .XCWorkspace file
  3. Delete the following files. Note the first two will come back when you restart XCOde:
  • project.xcodeproj/project.xcworkspace/contents.xcworkspacedata.
  • project.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist.
  • project.xcodeproj/xcuserdata/steve.xcuserdatad/xcschemes/xcschememanagement.plist