WhatsUpNSDoc
WhatsUpNSDoc

Reputation: 139

How can I delete an Xcode workspace?

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).

Upvotes: 7

Views: 6832

Answers (2)

SteveS
SteveS

Reputation: 514

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

Upvotes: 2

WhatsUpNSDoc
WhatsUpNSDoc

Reputation: 139

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

Upvotes: 3

Related Questions