Apparently MacOS doesn’t free up disk space right away and overall it’s more complicated process. Reference. This causes error in AppStore when trying to upgrade bigger in size apps like XCode.

If you go to Disk Utility you should see Available space and amount of purgeable space just near it.

To force disk space purge you need to fill up your free disk space first. Here is tldr version of this tutorial:

# go to any directory with write access
# 10g = 10GB file; adjust according to your needs
mkfile -n 10g largefile
rm largefile

# check out disk utility