How to "Delete derived data" in Xcode? - xcode

In Xcode5 there is simple option to Delete derived data:
In organiser menu (cmd + shift + 2):
But with new interface of Xcode6 there is no similar options.
Is there any quick methods to delete this trough Xcode6 interface?
Or now I should remove this folders in system manually?

Update again: in Xcode 12 go to Preferences -> Locations tab -> click the arrow by the DerivedData path to open it in Finder -> move DerivedData to the trash (Xcode will rebuild it)

exit xcode
In the Terminal application (I'm sure you have it open at all times ;^) type:
rm -rf ~/Library/Developer/Xcode/DerivedData
If xcode does not cooperate when you asked it politely to exit
from file menu or via Command-Q shortcut due to
some incessant popup craving for your attention in a pile of windows in a long forgotten space you could brute force the xcode eviction like so
killall Xcode; rm -rf ~/Library/Developer/Xcode/DerivedData
Caveat: if you won't exit the xcode first you'd get lingering files (courtesy of HFS I suppose)
and you'd have to use the Sheamus'es script. Feel free to share your experience with the newer (no longer experimental) macos fs in the comments below.
bash tip of the day: tab performs filename completion as you type paths
Tip of the year: consider procuring O'Reilly bash book[s] to save your time further. Disclaimer: I do not work for O'Reilly, never did. Just a happy
customer.
Though in my recent experience with Xcode 10.2.1 Windows(Cmd)+Shift+k shortcut works just fine.

Pressing Cmd + Shift + 2 In Xcode 6 will present Devices, which is separated from Organizer. Instead you can go Window, then Organizer, then find your project in Projects to delete derived data. You may set a short key in Key Bindings for quick access to derived data.

At Xcode 7.2.1 you can now the following:
⌘⌥⇧K
Which is Command + Option + Shift + K
Alternatively you can select Product > (Hold ⌥ Key) and select Clean Build Folder...
Edit:
I also like to create an alias for one of #anton-tropashko's suggested shell commands:
alias nuke-dd='rm -rv ~/Library/Developer/Xcode/DerivedData'
Add this ^^ to your ~/.bash_profile or somewhere else that is sourced for each shell you start, then just type:
$ nuke-dd

The approach I'm using is to install the watchdog app (https://www.cerebralgardens.com/watchdog).
This app will automatically clear your derived data based on your preferences (e.g. when data exceeds a certain size, when xcode closes, daily at a certain time, manually or when a clean is detected).
EDIT:
For those who don't want to spend money, in Xcode 7 select the Windows menu and Project. You can then select your project and delete its derived data (see screenshot below). Note that if there is a blue dot next to your project it indicates that it is open. It is better to close your project before deleting the derived data.

I suggest to install the plugin DerivedData Exterminator by Alcatraz to clean up in Xcode6/7.
Please see the deriveddata-exterminator on GitHub.
===== Update =====
In Xcode8:
Window -> Projects (sometimes Projects disappears,try it again, maybe a bug)
Choose your project,then click the delete button.
Or using Alfred:
http://www.packal.org/workflow/xcode-cache-clean
just type xcl.

Xcode 7.3
Window -> Projects
Then Delete the Derived Data

You can use the command line. My shell script, works for Xcode 4, 5, and 6.
Sometimes, simply calling rm -rf on the Derived Data directory leaves a lingering file or two, but my script loops until all files are deleted.

rm -rf ~/Library/Developer/Xcode/DerivedData
Then in terminal, type purgeallbuilds, and all subfolders of DerivedData are deleted.

Sometimes I have hit on Delete button on DerivedData in (Window -> Projects) but it doesn't work.
Then I solve it by click on this small icon on the right of DerivedData path. It will navigate me to the DerivedData folder.
And in DerivedData, I remove DerivedData by Move To Trash and it removes successfully

You can delete derived data by clicking on the going into Xcode > Preferences.
See the tutorial I found below.
https://www.youtube.com/watch?v=ueEMGXKDBAc
This image shows a screenshot from the video which will guide you the exact location in Xcode preferences.

Related

Xcode 9 Autocomplete Not Working 100% - Partially Working

This morning, Xcode 9.0 (9A235) shows a new/strange Auto Complete box that is not at all what it used to be. How do I get the full auto-complete box so that autocomplete looks like how it usually does?
Try:
Go to Xcode > Preferences > Text Editing
Under Code completion - Uncheck 'Suggest completions while typing'
Quit out of Xcode and then relaunch Xcode.
Go to Xcode > Preferences > Text Editing again
Quit out of Xcode and then relaunch Xcode.
Now go to Code completion and check 'Suggest completions while typing'.
Try typing library function or enum and enjoy!
Deleting the DERIVED DATA folder seemed to fix my issue. Thanks to this post: swift println() not showing autocomplete options while writting code
Things to try:
#1
Run this command in the project directory if you use cocoapods:
rm -rf ~/Library/Caches/CocoaPods;
rm -rf Pods; rm -rf ~/Library/Developer/Xcode/DerivedData/*;
pod deintegrate; pod setup; pod install;
#2
**Clean Cached Data**
Clean the Project -> Cmd+Shift+K
Clean the Build Folder -> Cmd+Shift+Option+K
If you skipped step one:
Delete Derived Data
Xcode Preferences -> Locations ->
Arrow Symbol Takes you to DerrivedData -> Delete Folder
#3
**Check your Build Phase's Compile Sources.**
Every .swift and .m file in the project should be in this list or it won't autocomplete in those files.
#4
**Optimize your Editor:**
Use fileprivate* on every class property and function that you can to reduce the scope of the Compilers work per item.
Write modular/OOP code so you have less code for the compiler to read.
Avoid using Type Inferance when the result is a complex calculation, and try to break down complex calculations into let this = smallerOperation statements
* In Swift 4 private became stricter than fileprivate
In Xcode 12 there have been significant improvements in how often deleting derived data is necessary (though freezing has increased).
Xcode Version 11.0 (11A420a)
I have tried the solution from Lal Krishna for Xcode V11.0. It worked a few times but later I got no result.
I found one solution. You must delete two files:
Library/Developer/Xcode/Derived Data (as described before)
Library/Developer/Xcode/UserData/IDEEditorInteractivityHistory
That solution helps me now. May be useful for others 😉
This can happen when the file is not a member of the Target. Open the file where autocomplete is not working and show the the "Utilities" tab in the top right of Xcode (blue in the screenshot below).
Ensure your Target (typically your app's name) is checked. Autocomplete should work almost instantly without restarting Xcode, cleaning, or deleting Derived Data.
If it is already checked, make sure to uncheck and recheck it again. For me, it did the trick.
I'm using Xcode 10.2 and I had the same issue.
This answer from axel helped me to fix.
Anyway, I'm going to describe a bit more:
Go to YourProject.xcodeproj by clicking with Right Mouse Click and open Show Package Contents
Go to xcuserdata and delete your youruser.xcuserdatad
If you have also the xcworkspace(if you already have any pods installed) then do step 3&4, if not then just skip step 3&4:
Go to YourProject.xcworkspace by clicking with Right Mouse Click and open Show Package Contents
Go to xcuserdata and delete your youruser.xcuserdatad
Quit Xcode
Delete Derived Data by using Terminal:
rm -rf ~/Library/Developer/Xcode/DerivedData
Open Xcode and check if it works.
This can also happen if you redundantly named your files. For example,
Data.swift
Data.swift
Here's a bit of workaround but works.
Clean the project... Command + Shift + K
Clean the build folder... Command + Shift + Options(Alt) + K
Delete derived data for the project...
This can be done with the help of this link:
How can I delete derived data in Xcode 9?
Close XCode.
Reopen XCode (let the indexing complete) and Build the project... Command + B
Once it will be done with building, The suggestions will be back. I have tried it twice.
Update:
Sometimes the issue can be as simple as Duplicate file names.
Carefully check if any new file names added by you are conflicting with older files.
In Xcode 11.4, even if you move an existing file to another group, the suggestions disappear. This can be cured simply by restarting Xcode.
Removing the file from the Test Targets fixed my problem.
After a long time of searching, I finally fixed the issue for me. In Xcode > Preferences > Text Editing, in "Code Completion", I had "Use Escape key to show completion suggestions" checked for some reason. As soon as I unchecked this box, auto completion worked like a charm, without even needing to restart Xcode! (Xcode 10)
Please try doing this:
Select the file >> check if the file is added to UITesting or UnitTesting targets (File inspector -> Target Membership). If so, please uncheck those two and make sure only the project target is selected. Then build and try if autocomplete is working fine.
This worked for me. Hope it help someone.
For Xcode 11.4 (11E146)
Back Slash in folder name breaking the autocompletion feature, If this is the case remove it and build again.
I added here what was going on in my project just in case it can help someone else... I had 2 files with the same name and I didn't realise.
Just lost a day trying to solve the autocomplete nightmare of Xcode (9.2). Deleting derived data seemed to work briefly then things reverted. Reboots etc and other suggested voodoo failed to make a difference.
I gave up and download the 30 day trial of AppCode from Jet Brains. Autocomplete worked fine there and this maybe coincidence but it then started working again in my project in Xcode. Can't guarantee that it'll keep working...
It seems to be file specific in my case (Xcode 9.2) For me the fix was:
Delete problem file (remove reference)
Clean and Build
Add file back into the project (I did not check test targets)
Build again
Finally after 3 hours of trying everything - autocomplete works as it should.
Problems mostly because there are missing location of some files in project navigator (build errors)
Press command+1 to open Project Navigator pane
Check if there are any missing files
Or you can:
Delete DerivedData (command+shift+K)
Clean build folder (command+shift+option+K)
Press build again (command+B)
You should see build error that Xcode could not find some files that prevent build tool to process auto complete.
Correct and fix any missing files that you see.
Hope this helps
Use Command + B
or Command + R to Build or Run the project
Xcode sometimes messes up ;)
Xcode 11.3, macOS catalina
process parsecd achieve 100% of cpu, so kill it helps me
goto underneath directory and delete all folders on it.
{Your User}/Library/Developer/Xcode/DeriveData
It worked for me.
For me it was happening in my test file, because it wasn't part of a target for some reason. Setting it's target membership solved the issue.
For me, the problem occured when I discarded all the changes of one file (under Source Control > Commit), which effectively deleted the file. This is what I wanted and I thought that the file and all references to it would be delted too.
However, there was still a reference to the file (shown in red) in the Project navigator. Deleting the (now non-existant) file in the Project navigator magically brought auto-completion back.
No amount of cleaning, deleting derived data, etc helped. I only realized the deleted file was still showing when I tried to build my project, which of course failed because it couldnt find that file.
Hope this will help someone save 30 minutes :)
check whether you selected the Suggest completions while typing in Xcode -> Preferences -> Text Editing
navigate to user->Library->Developer->Xcode->DerivedData in Finder and delete the DerivedData folder
My case might appear too specific to help, but it might give someone an idea of how to solve broken auto-completion. Xcode 10.2.1.
In my case, auto-complete stopped working entirely and non of these other answers helped me. In addition, the fan on the computer could be heard to go louder indicating something was overworking (no other apps running), it should be noted I was editing on a MacBook Pro laptop. It seemed to be linked with the editor struggling to parse the equation I'd written:
switch mtype {
case .indeterminate:
newPosition.x = (frame.width - mainFigureText.frame.width) / 2
case .right:
newPosition.x = (((frame.width / 2) - mainFigureText.frame.width) / 2) + (frame.width / 2)
case .left:
newPosition.x = (((frame.width / 2) - mainFigureText.frame.width) / 2)
}
I was looking to animate a text view left, right, or to the middle depending on user prefs. The newPosition is a CGPoint that the text will animate to. Anyway, I split the equations up and all of a sudden auto-complete started working and the fan went quiet! I've been able to recreate this specific problem more than once by re-typing the above code and then replacing it with:
let halfFrameWidth: CGFloat = frame.width / 2
let middleLeft = (halfFrameWidth - mainFigureText.frame.width) / 2
switch doseType {
case .right:
newPosition.x = middleLeft + halfFrameWidth
case .left:
newPosition.x = middleLeft
default:
newPosition.x = (frame.width - mainFigureText.frame.width) / 2
}
I would like to add one more to the pile of solutions, because it is the only one that worked for me and is nowhere to be found here.
Xcode normally comes with two default build configuration for every project. Release & Debug. I have an extra one for my unit tests called Testing. In Xcode 10.1, 10.2, 10.3 and 11 beta, the new build system does not seem to like it and will only auto-complete if you either use Release or Debug. Any custom build configuration breaks auto-completion in mixed (swift + objc) project with unit tests.
I faced the same problem in Xcode 11.3.1. In my case The issue was cause due to duplicate file names / Deleted file name. Better to run the application once and check whether there are any deleted files/classes so that you will get a syntax error.
This Link helped me. Open the Build Settings & fill the framework search paths. See the below image.
Build errors can break the autocompletion feature in Xcode.
I had the issue with 100% not working auto-complete, none of written here helped. One thing I noticed – it was broken right after adding some entities into .xcdatamodel file, which have codegen class definition by default.
So I wasn't surprised when using old-style codegen none (and generating classes of course) fixed the issue immediately, even without restarting the xcode.
With Xcode 11.1, simply performing Clean Build Folder or deleting derived data was not enough to fix autocomplete.
Only after restarting my Mac, everything was back to normal
If you have issue with weird completion/auto-completion/intellisense (not showing default stuff like delegates and datasource protocols methods) just change your target (e.g. from simulator iPhone 8 to real device), build the project and switch back to your original target.
Similar with issues with Interface Builder (storyboards) not showing anything, but only "nothing selected" whenever you select any part of the view. Just switch to other Xib/Storyboard (or even create new), check if it works there and switch back.
These workarounds worked for me in both cases (had both issues in one day with one project on Xcode 10.2.1). From what I've seen all over internet forums it seems these are bugs never fixed since Xcode 6.x or so.
Cheers!

How to "Delete derived data" in Xcode8?

In Xcode7 you click Window -> Projects and select the projects that you want the derived data to be deleted.
But with Xcode8 beta 2 the project menu no longer exists under the Windows menu.
Are there any quick methods to delete the derived data through Xcode8 interface?
Close Xcode
Open Terminal and enter this command
rm -rf ~/Library/Developer/Xcode/DerivedData
You can not use shift-alt-command-k.
shift-alt-command-k - This will delete all of the products and intermediate files in the build folder.It's different from delete derive data.
Yep, the 'Window/Projects' menu choice is missing, so it's all back to manual now.
Go to Prefs/Locations>Derived Data, where you can tap on the tiny arrow at the end of the derived data path to open it in the Finder, however. Then you have to figure out which one you want to remove.
Below is screenshot..
1)
2)2nd way to delete derive data File->Project Setting...
You can add an alias to the bash. Open Terminal:
sudo nano ~/.bash_profile
alias DeleteDerivedData='rm -rf ~/Library/Developer/Xcode/DerivedData'
Ctrl + o
Ctrl + x
source ~/.bash_profile
So then, whenever you want to delete the derived data, go to the Terminal and type the alias you've created (DeleteDerivedData).
For Xcode Version 8.2 (8C38), you can remove the projects completely (project name in Xcode, programs, data, derived data, etc.) one by one by doing the following: [Note: the instructions are not for just remove the project names from the Welcome Window]
Launch the Xocde and wait until the Welcome window is displayed. The projects will be shown on the right hand side
Right click the project you want to remove completely and a pop window [Show in Folder] jumps out; selec it to find out where is the project in the [Finder]
Right click the project folder in the Finder to find it’s path through [Get Info]; use path in the Info window to go to the parent folder, and go to there
Right click the Project Folder (e.g. DemoProject01) and Porject file (DemoProject01.xcodeproj) and select [Move to Trash] ; you will see that (a) the folder in finder is removed AND (b) the Project in the Xcode Welcome Window’s Project List is removed.

Xcode 4.3.2 show hidden files

I am using Xcode 4.3.2 and I am trying to add some SDK references to my project.
I can SEE the files using Finder, as I used the terminal script to view hidden files.
Yet, when I go to my user home directory in Xcode finder, it does not show the "hidden" 'Library' folder under my user profile that stores my SDK files.
Scratching head
Press and hold the ⌘ + shift and . keys at the same time.
Then you can switch to view hidden/non-hidden files.
Answering you 9 months later from OS X 10.8 Mountain Lion...
Press ⌘ShiftG from within Xcode's Open dialog -- this is the Go To Folder command from Finder. This works in XCode's Open dialog as well. You could go to 'Library' or, as I did below, go to the otherwise hidden .config directory by typing '.config'
This screenshot shows both the process & the result of opening the .config folder. Note that I've already 'gone' to the .config folder once, which is why it's displayed on the left, above Applications.
Which command are you Using ?
Use Bellow Command it worked for me.
If the Library folder is not visible in your folder, enter the command "chflags nohidden ~/Library/ " on Terminal(Applications->Utilities->Terminal) application
Had a similar problem (but arrived on this page looking for answers).
I removed a reference to a file in XCode which I actually wanted to keep but the file still existed in finder.
Even though the file is in the correct folder, Xcode won't acknowledge it until you re-add it via File > Add Files To "YourProject"
The point I'm making is that the files in your code project folders vs. those actually included in the XCode project are two different things

Xcode- Deleted images appear in simulator

Mac OS X Lion v10.7.2
Xcode v4.2.1 Build 4D502
gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.1.00)
GNU gdb 6.3.50-20050815 (Apple version gdb-1708) (Thu Nov 3 21:59:02 UTC 2011)
I have a bunch of images in my resource folder, but when I delete those images and run in simulator again, the images are still there. I have completely deleted the images from the Project Editor window (not from Finder), and I used DELETE (not Remove Reference Only), and they are still showing up in the simulator. If I add new images back in (with the same names) thru the Project Editor window (not from Finder) the old ones are still being used as well instead of the new ones.
I have tried:
1) Deleting images from Project Editor window.
2) Delete app from simulator (click and hold, then delete while wobbling), then restart computer.
3) Choosing Product > Clean.
4) Choosing Product > Option+Clean.
5) Choosing Show Package Contents of .xcodeproj file, and deleting everything in the xcuserdata folder.
This is an incredibly annoying bug!
How do I tell Xcode to stop using cached images?
I am newbie, so something like "Clean Targets" does not mean anything to me, unless you give me the instructions on how to do it as well.
Thanks
EDIT:
Here is another option we all missed, which might do the same thing as deleting the /Simulator/../Applications folder:
In the iOS Simulator menu, there is an option called Reset Content and Settings ...
it never occured to me that the simulator was a separate app from Xcode, so I never thought to check menu items while simulator had focus!
Manually removing the build folder may help. Clean does not always do this properly, for reasons unknown. The build folder used to be in the project directory, but now (also) exists in ~/Library/Developer/Xcode/DerivedData/
Solved by original poster:
Oh wait I had a brainstorm because of your suggestion above, and from
Terminal I used: find . -name 'myimage.png' 2> /dev/null and I found
the secret hidden cache! It is in my user library here:
~/Library/Application Support/iPhone Simulator/4.3.2/Applications/
Just delete everything in the Applications directory. May also need to
do this one as well: ~/Library/Application Support/iPhone
Simulator/5.0/Applications/
I had the same thing when I was adding transparent background to an image that was already part of the project.
What worked:
1) Delete app from Simulator (long press and hit X).
2) Also I had to remove old image files from project and then reload the new transparent background images into the project.
Also hit Project > Clean multiple times.
I had the same. Very strange because the simulator displayed the no longer existing
images and the development-phone displayed the correct images.
I had already removed them from the folder. And deleted them from the simulator. For me
a Product > Clean did the trick.
After I did the "remove fromfolder"/"Reset content and setting"/remove app from simulator", I still had an old image hanging around in the simulator. Then I did a "Project>clean". Then the detailViewController.xib file disappeared from the folder. It is still present in XCode, but can not be found anymore when running the app in the simulator, cousing a crash. What is the problem here?
I believe that since Lion, this has changed to '/Users/[user name]/Library/Application Support/iPhone Simulator/[version number]**'. Be careful however, the Library folder is hidden. To view it, open the Terminal and run this:
defaults write com.apple.Finder AppleShowAllFiles YES
I had to
1) Delete the images from the folders.
2) Delete the app from the simulator.
3) Clean.
4) Stop the simulator and restart.
Only when I had done each of these could I get rid of old resources
I had this issue as well. Deleting the app from the simulator (In the simulator do Hardware -> Home, click + hold on app icon till icons jiggle, click the x just like you would do on a device). Running again used the correct images.
Running sudo rm -rf ~/Library/Application\ Support/iPhone\ Simulator/7.*/Applications fixed the problem for me. You might have to change the 7, depending on which version you'll have in ~/Library/Application Support/iPhone Simulator

Xcode Crashing When Opening Project File

Xcode keeps crashing on me when I open my project file. I've been able to open it fine for weeks now. Not sure how to diagnose. It only crashes for a specific project.
Process: Xcode [1293]
Path: /Developer/Applications/Xcode.app/Contents/MacOS/Xcode
Identifier: com.apple.Xcode
Version: 3.2.5 (1760)
Build Info: DevToolsIDE-17600000~5
Code Type: X86-64 (Native)
Parent Process: launchd [189]
Date/Time: 2010-12-15 16:05:24.659 -0700
OS Version: Mac OS X 10.6.5 (10H574)
Report Version: 6
Interval Since Last Report: 201 sec
Crashes Since Last Report: 4
Per-App Interval Since Last Report: 80 sec
Per-App Crashes Since Last Report: 4
Anonymous UUID: 2B7F7CFC-45EA-450C-8467-6BF1E356B6F6
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000025940
Crashed Thread: 10 Dispatch queue: com.apple.Xcode.index-access
Application Specific Information:
objc[1293]: garbage collection is ON
The crash is generally a sign the project file has been corrupted. Here's a list of possible things you can do to try to fix it.
1. Fix a corrupted *.pbxproj file
Caused by a merge conflict
If you are using version control, it might be caused by a merge conflict that has not yet been resolved.
Using Finder, open the directory that holds your project.
Right click the project file YOUR_PROJECT_NAME.xcodeproj and Open With your preferred text editing tool such as Sublime Text.
Look for merge conflicts which are usually marked using a series of ========= bars.
Resolve the merge conflicts manually or remove the changes of one side.
Caused by unreadable XML
If that fails go into the file and quickly scroll through to see if anything seems out of place - it should generally be readable XML. You could even try an XML validator against it to see if anything amiss was found.
2. Reset your workspace
Using Finder, open the directory that holds yor project.
Right click the project file MyProject.xcodeproj and choose Show Package Contents.
Delete the xcuserdata folder, which should contain a folder with your username on it.
Repeats step 2 and 3 for your workspace file MyProject.workspace
As elaborated by KennyWinker and Paul R on the answers below.
3. Recreate your Xcode project
Note that this should be your last resort as it is quite tedious to do for large projects.
Lastly you could simply re-create it. That might seem like a big pain, but basically you could just create a new project and drag everything under the "Classes" folder into Xcode to start using it (don't forget to also add the frameworks you need).
Just wanted to elucidate on #Paul R's comment.
I had a situation where Xcode was crashing every time I opened a project file. It seemed to be connect to the IB window that was opening. In the end it was deleting the contents of MyProject.xcodeproj/project.xcworkspace/xcuserdata/ that solved this. It did this by resetting the workspace (open files, window scaling, etc.)
Hope this is helpful.
What worked for me?
The only solution that worked for me was deleting the derived data folders of the hanging project, i.e the derived data folders in above directory: ~/Library/Developer/Xcode/DerivedData/. Hope it helps someone.
What didn't?
As mentioned at other places, deleting MyProject.xcodeproj/project.xcworkspace/xcuserdata/ or MyProject.xcodeproj/xcuserdata/ didn't work for me.
Just wanted add some extra content to #Kenny Winker answer...
To delete your xcode user data go,
Find your Xcode project file ex: MyProject.xcodeproj or MyProject.xcworkspace
Right click on it and choose Show Package Contents
Finally, just delete everything inside the folder xcuserdata
Done! :)
Hopefully, this adds a bit more context to people who doesn't know where to find their project user data.
I had similar problem with Xcode 8.1. The reason maybe the project file contains merge conflict data.
You can remove this by opening Xcode project file in TextEdit.
However, in my case there was no merge conflict. Simply deleting content of DerivedData worked for me.
Steps :
Open finder window then select Go Tab -> Go to Folder… (or press Cmd + shift + G)
Enter ~/Library and press Go. This opens Library folder which is hidden by default.
Go to Developer -> Xcode -> DerivedData folder. Delete all the content of this folder.
The DerivedData is like cache i.e. create every time you build/run your app.
Now open the project. It should work with no issues.
Copying Answer of #Sean D which worked for me.
After seeing a suggestion here, I solved this issue by deleting Xcode's preferences. The most reliable way to do that is the following terminal command, issued after quitting Xcode:
defaults delete com.apple.dt.Xcode
ETA: Other suggestions have involved changing or removing certain individual preference settings, but after trying a few of those, none worked for me. There seem to be multiple incompatibilities in the preferences between 6 and 7b3, so trashing the prefs entirely should work around them all.
I did every solution on the thread. But nothing helped me. Don't know why.
Instead of opening the project through Xcode, I opened the project through the terminal using open Project.xcworkspace, it magically works.
Same thing happened to me, and it was some sort of versioning issue that I couldn't fix, so I reverted back to a prior version and it worked. Feels like there are a few bugs in XCode 4 that still need to be worked out.
Inside your project folder find projectName.xcodeproj or projectName.xcworkspace if you have installed pods right click on it and click on (Show package contents) and finally delete everything inside xcuserdata folder
Launch your project it will work fine
I had XCode crashing every time I opened Images.xcassets. The solution was to delete a corrupt PDF file I had just added.
Computer restart
worked for me. While
xcuserdata deletion
and
defaults delete com.apple.dt.Xcode
didn't work for me.
I even was not able to open xcode alone or any of my projects or single .m file.
I was also facing same issue, I did every things like below but didn't work for me!
Deleting the derived data:
~/Library/Developer/Xcode/DerivedData/
Delete everything inside the folder xcuserdata:
MyProject.xcodeproj/project.xcworkspace/xcuserdata/
and
MyProject.xcodeproj/xcuserdata/
What worked for me?
In my case I have reinstalled Additional Component(Additional downloads) from below link then solved this issue.
https://developer.apple.com/xcode/resources/
If you have any open swift file in a new window (for example when you double click on a .swift file in xCode and it opens in a new window) when xCode opens this might be an issue. I think I had this window opened when closing xCode, then when opening xCode this window opens up again and for some reason crashes xCode. Try to close that open window quickly before it crashes. Strange, but that worked for me.
i tested a lot of ways but after of all i just and only change the directory of my project location every thing fixed and my Xcode works properly and I'm glad now....
I experienced XCode crashing when trying to edit a specific original.m file. None of the above solutions worked, but this did:
Create a new .m file as new.m for example.
Using a text editor open up original.m outside XCode, copy contents and paste into new.m inside XCode. Go back to working in XCode.
Delete and move to trash the original.m
Rename new.m to original.m
Now I can edit original.m without XCode crashing.
In my case there were two windows, one on the internal screen of my MacBook and one on an external each with several tabs opened before Xcode crashed and kept crashing on trying to open the xcworkspace file. The above mentioned solutions did not work. After disconnecting the external display, Xcode started without crashing and both windows were placed on the MacBook's screen. Reattached the display and everything worked as before.
I you use Cocoapods try pod deintegrate, delete the workspace, then pod install. This cured it here (Talking of Xcode 11.2.1 after upgrading the Mac to Catalina and the following crashing Xcode)
Towards a cocoa pods included project, I resolved this issue by renaming workspace file and running "pod install" on terminal again.
I was also facing same issue, everytime xcode was crashing. i restarted mac, cleared derived data/xcuserdata but nothing worked.
I had one more repo so i copied 'project.xcodeproj' file from there and paste it in current repo, this trick resolved my problem.
Go to project -> right click on .xcodeproj -> show package contents -> delete all files in xcuserdata.
Quit the xcode -> reopen
Delete the
Open project in previous version of Xcode and then close it and reopen it on Xcode version that you are using for project,
suppose you are using Xcode 11.1 and it is getting crashed while opening projects, then open it in Xcode 10.0 or 10.1.
Fix a corrupted *.pbxproj file
Reset your workspace
defaults delete com.apple.dt.Xcode
do 1~3 and
git clone ~~~.git newGitProject
copy MyProject.xcodeproj, MyProject.xcworkspace
go to GitProject
paste MyProject.xcodeproj, MyProject.xcworkspace
worked for me.
if you have git repository , try it ;)

Resources