macos-disk-cleanup

Basics: Purgeable space is not unused space.

Purgeable space is logically unoccupied at the scope of macOS System, but physically not.

Idiot apps like Xcode would refuse to install, though the “available” space is fairly enough, given that purgeable space included.

Use df -h to query for unused disk space physically.

Purgeable space can be released manually by making local snapshots thinner.

tmutil thinlocalsnapshots / 10000000000 4

Shrink TimeMachine backups.

Remove local Photo Library

Stop icloud photo syncing.

Remove unused Simulators

They can be downloaded again from Xcode when in need.

xcrun simctl delete unavailable/all

Remove unused Docker local image

JDK for macOS

You need the following to distinguish between built-in and user installed versions of JDK.

/usr/libexec/java_home -verbose