There is a handy way to clean Xcode Derived Data using Terminal. Please follow the below steps carefully.
- Check does your mac have
.zshrc
file. - Open terminal type
cd ~
this will switch your terminal to root directory. - Now type
ls -al
this command will show list of all files in that directory including the hidden files. - Check
.zshrc
file is available. - If you have
.zshrc
file go to Step 7. - If you don't have .zshrc file type
touch .zshrc
this will create a new .zshrc file. - Now paste this command
echo "alias blast='rm -rf ~/Library/Developer/Xcode/DerivedData'" >> .zshrc