Last active
November 23, 2021 11:20
-
-
Save ChenYilong/ea9ab19f2d492eba16e1b3fee2d9afd4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sh -c 'read -r -p "Have you quit your Xcode? [y/N] " response | |
if [[ "$response" =~ ^([yY][eE][sS]|[yY])$ ]] | |
then | |
echo "yes, I have quit my Xcode"; | |
else | |
echo "please quit your Xcode"; | |
fi;'; | |
df -k .; | |
df -h . | awk 'NR==2{printf "Disk count before clean: %s\n", $4}'; | |
sh -c ' echo "----------------------<start>----------------------";'; | |
echo "Removing old simulators..."; | |
xcrun simctl delete unavailable; | |
echo "Removing caches..."; | |
rm -fr ~/Library/Caches/com.apple.dt.Xcode/*; | |
echo "Removing Derived Data..."; | |
rm -fr ~/Library/Developer/Xcode/DerivedData/*; | |
rm -rf ~/Library/Developer/Xcode/iOS\ DeviceSupport; | |
rm -fr ~/Library/Application\ Support/MobileSync/Backup/*; | |
rm -rf ~/Library/Logs/CoreSimulator; | |
sh -c 'echo "------------------------<I>------------------------"; | |
echo "---------------------<waiting>---------------------";'; | |
rm -rf ~/Library/Developer/XCPGDevices/; | |
rm -rf ~/Library/Developer/Shared/Documentation/DocSets; | |
rm -rf ~/Library/Developer/Xcode/Products/; | |
rm -rf "$(getconf DARWIN_USER_CACHE_DIR)/org.llvm.clang/ModuleCache"; | |
rm -rf ~/Library/Application\ Support/Developer/Shared/Xcode/Plug-ins; | |
sh -c 'if command -v pod &> /dev/null | |
then | |
echo "Removing CocoaPods cache..."; | |
pod cache clean --all; | |
fi'; | |
sh -c 'read -r -p "Are you sure to delete ~/Library/Developer/Xcode/Archives? [y/N] " response | |
if [[ "$response" =~ ^([yY][eE][sS]|[yY])$ ]] | |
then | |
rm -rf ~/Library/Developer/Xcode/Archives; | |
echo " ~/Library/Developer/Xcode/Archives is deleted."; | |
else | |
echo "not to delete ~/Library/Developer/Xcode/Archives . " | |
fi;'; | |
open /Library/Developer/CoreSimulator/Profiles/Runtimes; | |
df -k .; | |
df -h . | awk 'NR==2{printf "Disk count after clean: %s \n", $4}'; | |
sh -c ' echo "-----------------------<end>-----------------------"; | |
echo "----------------------<🎉🎉🎉>---------------------"; | |
echo "---------------------<iTeaTime>--------------------";'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
curl -o- -L https://gist.githubusercontent.com/ChenYilong/ea9ab19f2d492eba16e1b3fee2d9afd4/raw/8323a6b356c436d8513c06b077b974ceaad55a87/CleanXcodeCaches.sh | bash -s