What can I delete from ~/Library/Developer/Xcode folder? - xcode

My ~/Library/Developer/Xcode folder is over 17 gigs in size. As I work in virtual machine (Parallels 12) with a 64 gig limit in total virtual disk size, I need to recover some disk space.
Amongst the folders such as:
Archives
DerivedData
Installs
iOS Device Logs
iOS DeviceSupport
Snapshots
UserData
What might I be able to delete without ruining my project?

Under Archives you can delete anything you want but you should keep recent builds. And you should backup older builds you might need to access in the future.
You can delete everything under DerivedData. Next time you build a project, the needed files will be recreated.
My Installs folder only contains a set of empty folders and the newest if over 3 years old. Check yours, that may be safe to delete.
The iOS Device Logs folder contains old device logs for various versions of iOS. You can safely delete any of the older logs.
The iOS DeviceSupport folder contains a folder for each version of iOS you ever had on an iOS device you ever connected while Xcode was running. Feel free to delete any folders for versions of iOS you don't support anymore. For example, if none of your apps have a Deployment Target older than iOS 8.1, for example, you can safely delete any folder for iOS 8.0.x and earlier. These folders are only needed to symbolicate crash reports.
The Snapshots folder is used by Xcode to save snapshots (backups). You can delete snapshots for old projects you don't care about.
I'd leave the UserData folder alone.

Here is explantation for each folder and what you can delete to reduce the size.
DeviceSupport - You can keep the simulator which log's you may need in future. It's symbolicate crash logs for different device/iOS.
Delete this folder after every few days interval. Most of the time, it occupy huge space!
~/Library/Developer/Xcode/DerivedData
All your targets are kept in the archived form in Archives folder. Before you decide to delete contents of this folder, here is a warning - if you want to be able to debug deployed versions of your App, you shouldn’t delete the archives. Xcode will manage of archives and creates new file when new build is archived.
~/Library/Developer/Xcode/Archives
iOS Device Support folder creates a subfolder with the device version as an identifier when you attach the device. Most of the time it’s just old stuff. Keep the latest version and rest of them can be deleted (if you don’t have an app that runs on 5.1.1, there’s no reason to keep the 5.1.1 directory/directories). If you really don't need these, delete. But we should keep a few although we test app from device mostly.
~/Library/Developer/Xcode/iOS DeviceSupport
Core Simulator folder is familiar for many Xcode users. It’s simulator’s territory; that's where it stores app data. It’s obvious that you can toss the older version simulator folder/folders if you no longer support your apps for those versions. As it is user data, no big issue if you delete it completely but it’s safer to use ‘Reset Content and Settings’ option from the menu to delete all of your app data in a Simulator.
~/Library/Developer/CoreSimulator
(Here's a handy shell command for step 5: xcrun simctl delete unavailable)
Caches are always safe to delete since they will be recreated as necessary. This isn’t a directory; it’s a file of kind Xcode Project. Delete away!
~/Library/Caches/com.apple.dt.Xcode

Related

Mac iCloud alters Xcode Pods breaking my build

Every couple days to couple weeks I am unable to build my project because Xcode states
"Use of unresolved identifier 'Fabric'
This also happens with Crashlytics
Now I've narrowed the bug down to some situation in my Pod Folder. To initially fix this I have to delete both Fabric and Crashlytics from the Pod file. Then do a pod install/update.
So the cause of this is, right beside my Fabric and Crashlytics folders there is a little cloud icon. I assume this is iCloud and it is changing my folders at what appears to be random intervals. How can I unhook these folders from the iCloud?
Or stop iCloud from breaking these folders/pods?
I found the meaning of this icon
It means that the file is stored only in the cloud and not on your computer.
Not sure why this behaviour is active on only these two pods.
New Update, I swear this failed before but clicking the cloud downloaded the file from the cloud for me and allowed me to build.
Edit: Add an empty file called .nosync and iCloud will ignore that directory and all of its subdirectories.
It seems like you're syncing your desktop and documents folders with iCloud Drive. The easiest way would be to move your Xcode project to another directory.
Maybe look into iCloud having an ignore list that makes it omit certain files.
You can also add pre-build actions to delete and redownload your pods in the scheme editor menu. This GitHub Repo explains what I'm talking about.
It seems you are storing your Xcode project and Pods folder into a folder syncing to iCloud (which could be Desktop or Documents folder).
The problem might occur for a number of reasons and I'd bet it's the syncing mechanism getting stressed by the build/pods system.
To address the issue:
create a folder "Development" in your User folder (for example /Users/Charles/Development) -> this folder will not be synced with iCloud
move your project to the Development folder
drag the folder to the Finder sidebar for easy access
if you were using iCloud to share the project across multiple Mac, go to BitBucket/GitHub and use a git repository instead. If you don't want to use Git but fancy cloud sync, use Dropbox or disable Mac storage optimisation in iCloud Drive settings

Can Xcode SDKs (such as watchOS and tvOS) be uninstalled?

I have installed Xcode in my machine in order to use it for desktop development (OS X/Cocoa/Command line tools). Whenever I create a new project, there are templates in the wizard for iOS, watchOS and tvOS development, but at this moment I have no interest in these SDKs.
Since Xcode.app is taking a lot of space in my disk even after a fresh install, is it possible to remove these SDKs and reclaim some space?
I found out how to do this. I don't know at this moment if this can have any side-effect on other components for Xcode that could fail. In that case it may be possible to reinstall it from the Mac AppStore again.
Xcode packages the SDKs for these different products as Platforms. There is a Platform for macOS, a Platform for iOS, and so on. All these Platforms are stored in this folder:
/Applications/Xcode.app/Contents/Developer/Platforms
It seems it's possible to actually remove platforms by deleting the correspondent folders inside, such as:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform
/Applications/Xcode.app/Contents/Developer/Platforms/WatchOS.platform
/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform
Whenever one or more of these folders are deleted, the New Project wizard won't even show them anymore as categories.
Above in incorrect. You will have to reinstall Xcode if you delete any of these folders. /Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform I deleted above Xcode wanted me to reinstall.
Try to delete all folders besides "developer" inside platform folders.
Example, delete all beside this:
/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/developer.
Other folders in that area you can delete

Xcode 7.3 taking too much space [duplicate]

After going through and cleaning my disk with old things that I didn't need anymore, I came across the iOS DeviceSupport folder in ~/Library/Developer/Xcode which was taking nearly 20 GB.
A similar question has been asked before, but since then many things have changed and I would like an up-to-date answer.
As long as I have the version I use for testing, can I delete the older/unused versions without breaking anything?
The ~/Library/Developer/Xcode/iOS DeviceSupport folder is basically only needed to symbolicate crash logs.
You could completely purge the entire folder. Of course the next time you connect one of your devices, Xcode would redownload the symbol data from the device.
I clean out that folder once a year or so by deleting folders for versions of iOS I no longer support or expect to ever have to symbolicate a crash log for.
More Suggestive answer supporting rmaddy's answer as our primary purpose is to delete unnecessary file and folder:
Delete this folder after every few days interval. Most of the time, it occupy huge space!
~/Library/Developer/Xcode/DerivedData
All your targets are kept in the archived form in Archives folder. Before you decide to delete contents of this folder, here is a warning - if you want to be able to debug deployed versions of your App, you shouldn’t delete the archives. Xcode will manage of archives and creates new file when new build is archived.
~/Library/Developer/Xcode/Archives
iOS Device Support folder creates a subfolder with the device version as an identifier when you attach the device. Most of the time it’s just old stuff. Keep the latest version and rest of them can be deleted (if you don’t have an app that runs on 5.1.1, there’s no reason to keep the 5.1.1 directory/directories). If you really don't need these, delete. But we should keep a few although we test app from device mostly.
~/Library/Developer/Xcode/iOS DeviceSupport
Core Simulator folder is familiar for many Xcode users. It’s simulator’s territory; that's where it stores app data. It’s obvious that you can toss the older version simulator folder/folders if you no longer support your apps for those versions. As it is user data, no big issue if you delete it completely but it’s safer to use ‘Reset Content and Settings’ option from the menu to delete all of your app data in a Simulator.
~/Library/Developer/CoreSimulator
(Here's a handy shell command for step 5: xcrun simctl delete unavailable )
Caches are always safe to delete since they will be recreated as necessary. This isn’t a directory; it’s a file of kind Xcode Project. Delete away!
~/Library/Caches/com.apple.dt.Xcode
Additionally, Apple iOS device automatically syncs specific files and settings to your Mac every time they are connected to your Mac machine. To be on safe side, it’s wise to use Devices pane of iTunes preferences to delete older backups; you should be retaining your most recent back-ups off course.
~/Library/Application Support/MobileSync/Backup
Source: https://ajithrnayak.com/post/95441624221/xcode-users-can-free-up-space-on-your-mac
I got back about 40GB!
I wrote a small command-line utility based on the great answer by #JamshedAlam for those who are tired of deleting the contents of those folders manually. Check it out here if you think it would help you.
Yes, you can delete data from iOS device support by the symbols of the operating system, one for each version for each architecture. It's used for debugging.
If you don't need to support those devices any more, you can delete the directory without ill effect

Recover xcode project from installed app on iPhone

I exedentaly deleted my xCode project, but I still have app installed on my iPhone. Is it somehow possible to retrieve at least some part of original project files from app itself?
No, it's not possible to do this.
You may be able to recover the original archive file created prior to installation on your device from inside the following directory (depending on how you deleted the original project) which may be of help.
~/Library/Developer/Xcode/Archives/

Prevent Xcode from keeping an old version of a project folder that I want to rename

I'm using Xcode Version 6.4 (6E35b)on a mid 2013 MacBook Air running OS X 10.10.5.
A few days ago, with my code in something of a tangle, Xcode crashed. After the crash, my app built and ran, but didn't do anything except eat memory at a fantastically fast rate.
I keep a git repository and every now and then a put a copy of the whole project folder on an offsite location.
I got one of my older versions out of storage, did a build and run and the same thing happened.
All copies of the same project (by name) now do the same thing. Run, eat memory, and nothing else.
I tried removing DerivedData, removing contents of /var/folders/, removing and replacing schema (in schema -> manage), removing all projects, emptying trash, and have removed Xcode (using "trash me") and reinstalling. No joy. Still the same thing.
I was wanting to change the name of the project anyhow, so I changed the name, and it works. Unfortunately, I can't seem to change the name of the folder containing the project. Using the file inspector, I'm able to change the names of almost everything, but info.plist wants to keep an extra copy of the old project folder name in it's path, as far as DerivedData and LLVM are concerned.
Right now I will continue working with the old project folder name, but new project name.
How do I make Xcode forget the old folder name?
As edited by John Caswell, the answer is basically covered by a careful reading of Duplicate and rename Xcode project & associated folders. I'm going to close this and resubmit the parts of the question that aren't answered.

Resources