问题
I am unable to take any more snapshots of a particular project of mine in XCode. If I try to create a snapshot, it says 'Creating snapshot ..' in the status bar and goes on forever. I then force quit the Xcode, relaunch and try creating a snapshot again. This time it straight away gives the error message '..remove file manually .. ...lock'. So I then remove the shown file using the rm command in terminal. And then I again try creating the snapshot and the same cycle continues.
How can I fix this issue?
I had been taking snapshots for this project for a long time and one day had to delete all the old snapshots as I suddenly realized that they are taking up 12+ GB! Even now if I try to create a snapshot for this project it reaches 3 GB in a few minutes and then I force-quit it. (I am pretty certain this used to work perfectly until some time back and didn't take gigabytes in space.)
回答1:
I too had the same problem and this is how I fixed it:
I noticed in Xcode -> Organizer -> Repositories that my whole ~/username folder was showing up as a repository. I tried deleting it in Xcode but it kept returning. Previously, before I had installed Xcode 4, and using Xcode 3, I had installed GIT and cloned opdenkamp/xbmc to my home folder. Through a lack of knowledge on the use of GIT, I had made my whole folder a repository and every time I tried to make a snapshot of my project in Xcode it was making a snapshot of ~/username (or some other process) that was taking for ever and creating a multi GB file in ~/Library/Developer/Xcode/Snapshots/ . In fact I would "force quit" Xcode to stop the process.
So I deleted the repository in Xcode, I quite Xcode then in the terminal I typed from my home directory ~/username
sudo rm -r .git
Probably not a good idea if there are repositories that you want to keep (which was not a problem for me) but now making a snapshot of an xcode project takes a second and generates a file that is of the order of the Xcode project and not now in the multi GB ball park
回答2:
Since you tagged this question git, I suspect git is the cause of your problem. I have found Xcode snapshots do not work if the project is in a git repository. If you need to take a snapshot, a workaround is to move the .git folder out of your project temporarily, take the snapshot, and move the .git folder back.
回答3:
the easiest fix is to make sure you have "Enable Source Control" checked in Xcode's Preferences (Source Control tab)
来源:https://stackoverflow.com/questions/11301239/unable-to-create-snapshots-with-xcode