Swift 3 / Xcode 8 Upgrade - 100's of DerivedData files missing from working copy errors

16,380

Solution 1

I was facing the same warnings after updating to Xcode 8 GM, over 350. Most of them where .swift files and images in the asset catalog.

It is basically a Source Control issue that seems to mainly appear when you move/delete project files. These are either new warnings or Xcode 8 is just a lot more strict with source control than Xcode 7.

After googling about this I found some answers, but they seemed complicated to me e.g using command line or even suggesting turning source control off and back on.

Here is what worked for all my projects.

Short Way

Try this first and if it does not work than do the long way

1) Go to Source Control menu (top menu next to window and help) and click Refresh Status

2) Go to Source Control menu again and click commit

3) The commit window should open with all the commits Xcode thinks are necessary. So just enter a commit in the text field box and press the commit button.

Repeat step 1-3 until there are no more items selected by Xcode when you open the commit menu. Do not go to step 4 until all the items automatically selected by Xcode have been committed otherwise you might get an error when doing step 4.

4) Open the commit window again and as mentioned in step 3 there should be no more items selected by Xcode. However you should still see some items in the left sidebar which are the ones causing the warning messages.

Right click on a item and press select all, enter a commit in the text field and than press the commit button. Everything should complete and the warning/errors should go away (optionally press CommitMenu->Refresh Status again).

If it does not complete than close/reopen Xcode and than redo step 1-4.

If that also does not work than the long way should fix it.

Long Way

If you use source control and make commits regularly than optionally do step 1 and than you should be able to go straight to step 11.

1) Clean xCode derrived data (Optionally)

You usually dont have to do this so skip this step on your 1st attempt and go to step 3.

Go to Xcode preferences, click on the "locations" tab, and then go to advanced. Click on the little arrow next to the advance button to open the path to the derived folder. Close Xcode completely and than delete all content that is in that derived folder.

As member Krivvenz has so kindly pointed out in his answer you might have to optionally do this. I did not have to do this myself so maybe skip this and only try it if it doesnt work.

"I also had to change my DerivedData option from relative to Custom which can be found in Xcode > Preferences > Locations Tab."

2) Relaunch your Xcode project and wait for the indexing to finish. This might take a few minutes because you just deleted the derived data.

3) Go to Source Control menu (top menu next to window and help) and click Refresh Status

4) Go to Source Control menu again and click commit

5) The commit window should open with all the commits Xcode thinks are necessary. I had over 250 as I never used source control before.

6) Click on commit changes at the bottom right

7) I got an error and the operation did not finish (if it works for you than go to 11)

8) Go to Source Control menu and click Refresh Status

9) Go to Source Control and click commit

10) Click on commit changes at the bottom right. This time it suggested about 30 commits less and I got no errors. If you still get errors on your 2nd attempt try closing Xcode completely and than reopening it and than repeat this step.

11) Go to Source Control menu and click Refresh Status

12) Go to Source control menu and click commit

13) This time there should be no changes recommended by Xcode but you will still see a lot of files in the commit menu on the left (unticked). Its these files that are throwing the working copy warnings, which should also still be there.

14) Select every one of those files in the left sidebar of the commit menu. You can right click and press check all

15) Click on commit changes at the bottom right

16) I got an error and the operation did not complete. So I tried again and same error, so I closed the commit menu. If it completes for you thats fine too.

17) Go to Source Control menu and click Refresh Status

Boom all the warnings disappeared.

18) Close your project and Xcode completely

19) Open your project again

20) Go to Source Control menu and click Refresh Status

21) Go to Source Control menu and click commit

22) I suddenly had 150+ commits suggested again. Make sure all suggestions are selected and than click on commit and it should complete without errors.

23) Clean your project (Product->Clean)

24) Go to Source Control menu and click commit. There should be no changes required and there should also be no files in the left sidebar.

After all this I have no more warnings, didn't need to delete source control and everything is working again as usual.

If you get more errors in the future, say because you moved a file again, than just make commits again, making sure everything is selected.

Hope this helps.

Solution 2

This is a bug in XCode. The missing files warnings disappear as soon as you git-commit your project tree.

Solution 3

I had a rogue .git folder in a parent folder that didn't 'go' to anything-

verify under "Source Control" menu that all of your "Working Copies" actually connect to a real source control folder

NONE of these 'solutions' worked for me, except this removing rogue .git folder

Solution 4

Removing DerivedData and git add . from terminal, even without commit, solved this issue for me.

Solution 5

Just show all hidden files and then delete git folder Open Terminal and run this command to show all hidden files "defaults write com.apple.finder AppleShowAllFiles YES killall Finder"

Share:
16,380
Krivvenz
Author by

Krivvenz

I'm interested in making apps and want to be a part of something big. I'm still constantly learning and improving.

Updated on June 06, 2022

Comments

  • Krivvenz
    Krivvenz almost 2 years

    I have just upgraded to the latest Beta version of XCode and Swift but after using the converter my app project now has over 200 build time yellow errors all stating /"projectDirectoy"/DerivedData/XXXXXXXXX/XXXX/XXX/xXXX/xXX is missing from working copy... where by the XXXXX's represent various file paths in the DerivedData folder.

    I have tried deleting the DerivedData folder from the location mentioned in the errors.

    I have tried deleting everything in the DerivedData folder in ~/Library/.

    I have tried multiple times to clean the project, reboot and do a fresh build.

    I have tried turning off source control in preferences but I don't see why I should turn this off as it was on before I updated so I want it left on.

    These errors just won't seem to go away.

    Any ideas?

    • R Menke
      R Menke almost 8 years
      i just ignore them, they seem to be an xcode bug with no effect on the actual build.
    • Vince O'Sullivan
      Vince O'Sullivan almost 8 years
      In my experience, the only reliable way of deleting the DerivedData folder is to close Xcode first. This will the force a full recompilation at the next build. Sometimes Xcode appears to prevent deletion of that directory or, at least, some of its contents.
    • Krivvenz
      Krivvenz almost 8 years
      I tried that Vince and it doesn't work. You see a message at the top of XCode saying that it is indexing and linking the files but the errors are still there. I might try re-creating my project and just copy and paste each and every file into a new project.
    • crashoverride777
      crashoverride777 over 7 years
      Did you find a solution to this? I have the same problems since upgrading to xCode 8 GM. I have found a few suggestions but I dont understand them.
    • crashoverride777
      crashoverride777 over 7 years
      I actually managed to fix it. If you still have this issue check out may answer.
  • Nico
    Nico over 7 years
    Worked for me as soon as I made the commit.
  • crashoverride777
    crashoverride777 over 7 years
    Awesome. It seems Xcode 8 is more strict with these warnings. I get them Also when I delete a file not from within Xcode
  • abhimuralidharan
    abhimuralidharan over 7 years
    Best answer.I had to select 542 files one by one to commit.
  • crashoverride777
    crashoverride777 over 7 years
    Thats great. I feel your pain, I had about 350-400 and it took forever.
  • SH10151
    SH10151 over 7 years
    Thank you! This worked for me, should be marked as correct answer, imo.
  • crashoverride777
    crashoverride777 over 7 years
    Thanks and Im glad it helped.
  • Krivvenz
    Krivvenz over 7 years
    This doesn't work for me. They all re-appear. IN step (1) do you mean go to Product > Clean in XCode?
  • crashoverride777
    crashoverride777 over 7 years
    You can google how to clean derrived data. Did you follow all steps?
  • crashoverride777
    crashoverride777 over 7 years
    Thanks for the feedback. I will include this in my answer if you dont mind.
  • Krivvenz
    Krivvenz over 7 years
    Yeah no worries. Finally sorted it!
  • c0deblooded
    c0deblooded over 7 years
    If you want to avoid checking each file one by one you can right-click a folder and select 'Check All'.
  • crashoverride777
    crashoverride777 over 7 years
    Hey, Thanks for the comment. I actually realised this after I have done the 1by 1 tick haha. I updated my answer already to include this.
  • SinisterMJ
    SinisterMJ over 7 years
    This worked for me also, I think most people if they were using source and already committed changes they wanted, could skip right to step 11 and look for those files XCode leaves unchecked - for me they also had a "!" next to them and XCode noted they were missing. Those were the files I needed to check and attempt to commit, then they vanished...
  • crashoverride777
    crashoverride777 over 7 years
    Hey, thanks for the comment. You are right, I will add this to my answer. Thanks again
  • salo.dm
    salo.dm over 7 years
    I got the same warning for a .xscheme file. Committing the xscheme & workspace files (even though they had no changes) by forcibly selecting them (steps 13 - 15) worked for me.
  • crashoverride777
    crashoverride777 over 7 years
    Awesome, I am glad it helped.
  • Tom Andersen
    Tom Andersen over 7 years
    This is the answer if you are using git on the main project. Just do a local commit -am "partly done swift 3 transition"
  • The Little DD
    The Little DD over 7 years
    Thanks you save my day! It works, I am lucky only 35 to commit~ Just refresh and tick and commit!
  • crashoverride777
    crashoverride777 over 7 years
    Awesome, glad it helped. Happy coding
  • Adam Eberbach
    Adam Eberbach about 7 years
    All I can say is "never rename your project". But this method worked for me too.
  • crashoverride777
    crashoverride777 about 7 years
    Hehe. This also actually happens if you just move files or rename them. It's a bit annoying. Glad it helped you.
  • Alex Reynolds
    Alex Reynolds about 7 years
    Worked for me. To clarify my warnings for missing files were in workspace A and the missing file paths were all for other workspaces or projects. It's clear my issue was not real missing files in my git that needed to be added. I found a .git folder is my parent folder. Fixed it!
  • Ajay Kumar
    Ajay Kumar almost 7 years
    Thank you so much!