log: 5

Clean Up Xcode Cache Files

4/24/2024

XcodeTerminal

Cleaning up Xcode cache files can help you save disk space and serves as a useful reference for future cleanups. Follow these steps to remove unnecessary files and directories without any side effects.

Note: that some of these files will be recreated when you run projects or create new ones.

Letโ€™s dive in.


Unused Device Data

  • Path: ~/Library/Developer/CoreSimulator/Devices

  • Execute command in terminal.

    xcrun simctl delete unavailable

This command deletes simulator data for devices that are no longer available or used. It safely removes old data that is no longer needed for your current development work.


iOS Device Support Files

  • Path: ~/Library/Developer/Xcode/iOS DeviceSupport

  • Delete debug directorys if necessary.

These directories contain support files for different iOS versions used for debugging. If you no longer need to debug on older iOS versions, you can safely delete these directories to free up space. Note: These files will be redownloaded when you open a project that requires them.


Simulator Caches

  • Path: ~/Library/Developer/CoreSimulator/Caches/dyld/..

  • Manually delete each directory within this path.

These are cached files used by the iOS simulator. Deleting these caches can help reclaim space and will not affect your projects or simulator functionality, as they will be recreated when needed.


Build Caches

  • Path: ~/Library/Developer/Xcode/DerivedData

  • Manually delete each directory within this path.

This directory stores build data and indexing information for your projects. Deleting these files will force Xcode to recreate them as needed, but will not harm your projects. Note: These files will be recreated when you build your projects again.


Archives

  • Path: ~/Library/Developer/Xcode/Archives

  • Manually delete each directory within this path.

This directory contains archived builds of your projects. If you donโ€™t need to keep old builds, you can safely delete these to free up space.


iOS Device Logs

  • Path: ~/Library/Developer/Xcode/iOS Device Logs

  • Manually delete each directory within this path.

These logs are generated during development and debugging. If you donโ€™t need to review old logs, you can delete them to clear up space.


Other Unnecessary Files

  • Path: ~/Library/Caches/..

  • Manually delete each directory within this path.

This general cache directory stores temporary data for various applications, including Xcode. Deleting these caches will not affect your projects and can help free up space on your Mac.