Xcode cleans up storage space

Article from Date Pudding http://www.cocoachina.com/ios/20170711/19814.html

Please choose to delete

Remove the cache file (DerivedData) generated by Xcode running and installing the app

As long as you re-run Xcode, it will be regenerated, and as the number of running programs increases, the space will become larger and larger. Re-running the program after deletion may be slightly slower, and regular cleaning is recommended.

path:

1
~/Library/Developer/Xcode/DerivedData

Free space: 0~xx GB

Remove the historical version of the ipa packaged by the APP (Archives)

It cannot be recovered after deletion. The folders are arranged by date, so if you do not want to delete them all, just keep the latest versions. Personally, it is recommended to delete them all.

path:

1
~/Library/Developer/Xcode/Archives

Free space: 0~xx GB

Remove the historical version of the app icon packaged by the app (Archives)

It cannot be recovered after deletion. The folders are arranged by Bundle Idenifier, and then arranged according to the version number of the archive. If you look at the content of each version, it is actually your app icon. Personally, it is recommended to delete all of them.

path:

1
~/Library/Developer/Xcode/Products/

Free space: 30M

Remove emulator cached data (Devices)

Data about the simulator. The memory space occupied by each version of the simulator is about 10M. Each folder contains data for a specific system version of the device. Which device each folder corresponds to can be viewed in device.plist under it. After deleting, if you run the program immediately, an error will be reported. First close Xcode, then reopen the program, and run it. Running under this path will immediately generate the file corresponding to the version of the simulator.

path:

1
~/Library/Developer/CoreSimulator/Devices/

Free up space ≈ 12GB, personal recommendation is to delete all

Remove support for older devices (iOS DeviceSupport)

Generally, it is the folder that occupies the largest memory space. Even if all of them are deleted, they will be automatically regenerated when the device is connected for debugging. Generally, iOS is only backward compatible with two versions, so I removed all versions below 9.0.

path:

1
~/Library/Developer/Xcode/iOS DeviceSupport

Free up space ≈ 3GB/version

Remove invalid plugins (Plug-ins) in Xcode

Because you may have installed some Xcode plug-ins before, such as HighlightSelectedString, VVDocumenter-Xcode and other very convenient and easy-to-use third-party plug-ins, after Xcode is upgraded to version 8.0, it will become invalid. Xcode has integrated similar methods internally, so The ones installed before are also useless, but they still occupy the memory space in the original location. It is recommended to delete them.

path:

1
~/Library/Application Support/Developer/Shared/Xcode/Plug-ins

If you have never installed a plugin, this path probably doesn't exist.

Remove emulator support for older versions

If you accidentally installed many versions of the emulator, then you can delete some older versions. But when you need an older version of the emulator, you need to download it again. It is recommended to leave 1~2 versions, and delete the rest.

path:

1
~/Library/Developer/CoreSimulator/Profiles/Runtimes/

Free up space ≈ 2.5GB/version

Remove the playground's item cache (XCPGDevices)

After deletion, it can be regenerated, and all can be deleted. Running the program again will cache it.

path:

1
~/Library/Developer/XCPGDevices/

I haven't deleted this folder since I used Xcode for several years, and it takes up about 300M of memory space, which can be operated according to personal preference.

Remove old documents (Docsets)

It cannot be recovered after deletion. Development documents are stored in this directory. Generally, there are three files: com.apple.adc.documentation.iOS.docset (1.68GB), com.apple.adc.documentation.OSX.docset (2.62GB) and com.apple.adc.documentation.Xcode.docset (256.4M), if you only do iOS development, you can actually delete OSX.docset, because it takes up 2.62GB of memory.

path:

1
~/Library/Developer/Shared/Documentation/DocSets

The overall space is about 4.56GB

Remove the SDK version in the simulator (iPhoneSimulator.sdk)

Unrecoverable, please operate with caution. I personally only have the latest version of the sdk under this path, unless you delete it as appropriate when you have multiple versions of the sdk.

path:

1
~/application/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/

The space is about 4GB, please be careful when deleting

Tips:

After the above steps, you can free up more than 20GB of disk space, which is very helpful for the memory-constrained Mac Book. Feel free to provide more methods that I don't know about.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324928408&siteId=291194637