Xcode is an integrated development environment (IDE) created by Apple. It is primarily used for developing software for Apple platforms such as macOS, iOS, iPadOS, watchOS, and tvOS. Xcode provides a comprehensive set of tools, including a code editor, debugging tools, interface builder, and simulators for testing applications. It supports multiple programming languages such as Swift, Objective-C, C++, and more.
The heaviness and space usage of Xcode can be attributed to the inclusion of various SDKs, simulators, documentation, and support for multiple programming languages. Additionally, Xcode also keeps a local cache of built products and intermediate files, which can contribute to its overall disk space usage.
These instructions mostly written for software developers when they know how to use Terminal and willing to take the risks of removing files manually by themselves. You may want to backup your important projects and data before deleting any Xcode files.
Before going through all troubles, consider using a third-party app like CleanMyMac to scan your system for Xcode junk files and delete them with one click. It’s safe and easy for anyone.
Xcode can take up a lot of space on your Mac because it supports multiple operating systems and versions, and it stores a lot of data and files that you may not need anymore. Here are some tips to free up space by removing unnecessary Xcode junk:
~/Library/Developer/CoreSimulator/Profiles/Runtimes and moving them to the Trash.
~/Library/Developer/CoreSimulator/Caches and moving them to the Trash.
~/Library/Caches/com.apple.dt.Xcode and moving them to the Trash.
~/Library/Developer/Xcode/iOS DeviceSupport and
~/Library/Logs/DiagnosticReports and moving them to the Trash.
~/Library/Developer/XCPGDevices and moving them to the Trash.
If you really don’t need Xcode and want to free up disk space, you can completely remove Xcode and its associated files by following these steps:
Delete the Xcode app from the Applications folder by dragging it to the Trash or right-clicking and choosing “Move to Trash”.
Delete the Xcode preferences files from the Library folder by using these commands in Terminal:
rm -rf ~/Library/Preferences/com.apple.dt.Xcode.plist
rm -rf /Library/Preferences/com.apple.dt.Xcode.plist
rm -rf ~/Library/Caches/com.apple.dt.Xcode
rm -rf ~/Library/Developer
rm -rf ~/Library/MobileDevice
rm -rf ~/Library/Developer/XCTestDevices
Be careful when deleting files from the system directory, such as
/Library/Developer/, and do not delete the PrivateFrameworks subfolder, as it may cause your new Xcode installation to crash.