Same here, MBP M1 2020, macOS 12.2 (21D49), struggling with this problem for the entire day, Mac had panicked three times (!) on the way likely due to high pressure on the file system (I was actively using the Mac). I see progress in Console:
8:23PM
ASDAppQuery.resultsDidChange 497799835: <NSProgress: 0x600003712b20> : Parent: 0x0 (portion: 0) / Fraction completed: 0.8030 / Completed: 803 of 1000
8:33PM
ASDAppQuery.resultsDidChange 497799835: <NSProgress: 0x600003712b20> : Parent: 0x0 (portion: 0) / Fraction completed: 0.8310 / Completed: 831 of 1000
So, 10 fractions in 10 minutes. Probably, better leave the Mac be until it finishes this process.
Check this out: https://github.com/RobotsAndPencils/xcodes
Downloaded and installed in 1 hr! On an M1 Mac Mini ;-)
Doh! and just now 13.2.1
I saw a hint that since xcode has a huge number of files that an active virus checker can seriously impede performance. After several failues to complete I 'paused' clamav's sentry function until the install completed. Honestly, I don't that was what did it or my constant attention over a long time.
This still happens on ventura with Xcode 14.2 it is a very annoying bug that apple.. never fix.