Mac 911

How to share one keyboard and mouse with multiple Macs (and sometimes iPads)

You can use Universal Control, an external KVM, or virtual KVM software.
macOS Universal Control demonstrated across three displays
Apple