The easiest way is
BlackHole. It is a free download for a 2-channel and/or 16-channel virtual audio bus (Mac only).
It is pretty much the same as Soundflower (which is not supported anymore)
You just create an Aggregate device with BlackHole as the input device and route your System Audio (the speaker icon on your Menu Bar Extras) to BlackHole.
This is also useful for recording any video presentation (YouTube, etc.) to QuickTime because QuickTime doesn't let you select the output of an application directly, only an Audio Device
https://existential.audio/blackhole/