Xcode12 占用空间过大的解决方法及彻底删除Xcode

时间:2024-02-17 14:01:42

1、以前的xcode 10G的样子,现在的xcode 28G多点

空间是个问题,下面就不同的情况,作为处理?

解决:

1、如果不用xcode,那直接删除

echo Removing your Xcode...
sudo rm -rf /Applications/Xcode.app
sudo 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/Application\ Support/Xcode
rm -rf ~/Library/Developer/Xcode
rm -rf ~/Library/Developer/CoreSimulator
rm -rf ~/Library/Developer/XCPGDevices
echo Your Xcode has been removed completely.

将上面的代码,保存到文件removexcode.sh,到终端执行下即可。

 

 

参考:https://www.jianshu.com/p/2c775a186dc7

 

2、如果还要用,那要删除一些我们原本用不到的就可以,比如手表watchOS,电视tvOS

Xcode.app/Contents/Developer/Platforms/WatchOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/watchOS.simruntime
Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/tvOS.simruntime

直接删除就可以。

哈哈,之前装了一看28G多,空间一下子没了,这个咱个办呢。

参考:https://www.jianshu.com/p/be7903308a3f