Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode won't remove Derived Files

Tags:

xcode

ios

I need to figure out why it is that Xcode, suddenly and with no provocation, starts handing me this error and not allowing me to build my project. When I say, "without provocation", I mean I'm editing text in the database the app delivers text from, and checking my progress in the simulator, doing nothing in Xcode at all except cleaning, building and testing. Everything will be fine for several test sequences, then suddenly, changing nothing in my procedures, the app won't build and I get these errors:

error: remove /Users/casey-cayce/Library/Developer/Xcode/DerivedData/PEM-LTE-2016-gyoajgqmkkoluhgbrhjmgwakiejl/Build/Products/Debug-iphonesimulator/Living the Eucharist.app/images: Directory not empty

error: couldn't remove '/Users/casey-cayce/Library/Developer/Xcode/DerivedData/PEM-LTE-2016-gyoajgqmkkoluhgbrhjmgwakiejl/Build/Products/Debug-iphonesimulator/Living the Eucharist.app/images' after command failed: Directory not empty

I've gone to this Derived Data folder and physically deleted the contents, only to have Xcode restore those contents when I reopen the app, fail the build, then give me the same errors over again. My only solution so far is to completely delete Xcode and the Developer folder, reinstall Xcode, after which it behaves fora little while, but will eventually do the same thing again. I've done this 3 times so far today.

If anyone has any suggestions, please help me get this resolved so I can get this project exported and finished.

Thanks.

Additional info in response to responses:

I have:
1: Closed the project.
2: Opened the Projects, folder and deleted the Derived Data, seen the Projects folder go blank (empty) with "No Projects" showing in the window.
3: Made sure the trash is emptied.
4: Run "WatchDog," an app developed specifically for dealing with Derived Data issues in XCode.
5: Closed Xcode & re-opened.
6: Opened the project, cleaned, and run the Build command.

After all that, the same errors come up again.

like image 406
Cayce Avatar asked Mar 02 '16 13:03

Cayce


People also ask

How do I clear derived data Xcode 13?

Delete Derived Data Choose Window -> Organizer. Select the Projects tab. Select your project on the left. Next to the Derived Data line, there click the Delete button.

Where is the derived data folder Xcode?

DerivedData is a folder located in ~/Library/Developer/Xcode/DerivedData by default. It's the location where Xcode stores all kinds of intermediate build results, generated indexes, etc. DerivedData location can be configured in Xcode preferences (Locations tab).

How do I do a clean build in Xcode?

To clean the build folder you can use the shortcut Command+Option+Shift+K or Menu Bar → Product → Hold Option Key → Clean build Folder .


4 Answers

It is ok to delete DerivedData folder, you can delete all files from DerivedData sub-folder (Not DerivedData Folder) directly.

That should not take any effect. Contents of DerivedData folder is generated during the build time and you can delete them if you want. It's not a issue.

All contents of DerivedData will be recreated when you build your projects again.

I suggest you clean project project and build again, ALSO PLEAE MAKE SURE YOUR DELETED DerivedData folder is not in BIN please clean trash, it is important

like image 100
Grigori Jlavyan Avatar answered Oct 19 '22 21:10

Grigori Jlavyan


Check your "Copy Bundle Resources" in Build Phase, You should find some files(should be images in your situation) in that list twice. Delete them and rebuild.

like image 30
JianMing Avatar answered Oct 19 '22 20:10

JianMing


In Xcode go to Window > Projects, select your project and there will be the delete button to delete the derived data.

like image 1
Sanjan Piya Avatar answered Oct 19 '22 20:10

Sanjan Piya


As of Xcode 9/10 you'll be able to access the Derived Data folder by navigating to

File -> Project Settings

or if you use a Workspace:

File -> Workspace Settings

And press the arrow behind the path:

enter image description here

Go to the folder and delete the derived data

like image 1
Vittal Pai Avatar answered Oct 19 '22 21:10

Vittal Pai