If you want to record sound generated by the computer itself only (not the microphone), you can use a tool like BlackHole [1].
BlackHole adds a loopback audio device which can be used with the default video capture tool (select the loopback device in the options menu after pressing shift-command-5).
To be able to play audio from the speakers while you're recording, you need to add a multi-output audio device in the macOS "Audio MIDI Setup" app. Switch to the multi-output device by option-clicking the audio icon in the top menu bar. Now both the speakers as well as the BlackHole audio device will receive audio.
This is also really useful if you need to mute a Zoom call if you need to listen to something else (like an unrelated video). You can just temporarily set the Zoom audio output to the BlackHole device.
BlackHole adds a loopback audio device which can be used with the default video capture tool (select the loopback device in the options menu after pressing shift-command-5).
To be able to play audio from the speakers while you're recording, you need to add a multi-output audio device in the macOS "Audio MIDI Setup" app. Switch to the multi-output device by option-clicking the audio icon in the top menu bar. Now both the speakers as well as the BlackHole audio device will receive audio.
[1]: https://github.com/ExistentialAudio/BlackHole