Mac Docking Doctor

This is the workstation I actually work from: two monitors, one keyboard, one mouse, one microphone, and a foot pedal I hold to talk - shared across four computers (a mix of laptops and a Mac mini) that I switch between with a single keypress through one KVM switch. Hit the button, and both screens plus every peripheral jump from one machine to the next.

Below is the hardware, why I bought what I bought, how we configured the parts that fight you - and a prompt at the end that sets the whole thing up, whether you're replicating my rig on another of your own machines or building a similar one from scratch.

The workstation

  • Two 4K monitors, side by side, driven at once.
  • One shared set of peripherals - keyboard, mouse, a USB desk microphone, and a USB foot pedal for push-to-talk dictation. I never re-plug them; they follow whichever computer is active.
  • A KVM switch in the middle - the piece that turns a pile of computers into a single desk. One keypress moves both displays and all the peripherals to the next machine.
  • Four computers hanging off it right now - laptops plus a Mac mini - each doing its own thing, any one of them a keypress away.

Why this KVM (and what to buy)

Most cheap KVMs do one of the two things I needed. The one worth buying does both: dual-monitor output and multiple computer inputs.

  • Dual monitor. HDMI can't split one cable into two displays (no MST), so a real dual-monitor KVM has two HDMI outputs to the monitors and two HDMI inputs per computer. Mine is an 8K HDMI 2.1 unit - overkill on paper, but the bandwidth headroom means two high-res displays never fight for it.
  • Multiple computers. Mine takes four. Each computer plugs in with its own two HDMI cables, one USB uplink, and its own charger.
  • Why not a dock? A USB-C or Thunderbolt dock is a one-computer device. A KVM is specifically the thing that lets several machines share one desk - that's the whole reason to buy this category instead of a dock.

I'm currently maxed out at four, and it's working just fine for now. But I can see a world where it grows - plenty of teams run fleets of always-on Mac minis as workers, and if my agent workload keeps expanding I could imagine more minis on more ports, or a second KVM behind the first. For today, four is plenty.

The foot pedal (voice)

I dictate a lot, so a USB foot pedal is my push-to-talk button: hold it to record, release to drop the transcription into the field - then I read what's there, edit if I need to, and a quick tap sends it. Nothing goes out until I've reviewed it, and my hands never leave the keyboard. It rides the same USB uplink as the keyboard and mouse, so it switches with the KVM like everything else.

Configured through the pedal's own firmware plus a Karabiner-Elements rule: a hold sends the dictation tool's push-to-talk key (record while held, release to stop), and a quick tap sends Enter. The one thing to get right - the key the pedal sends has to match your dictation tool's actual push-to-talk binding, because those tools quietly change their defaults on you.

How we configured it

The wiring looks simple and then isn't. The parts that bit us, in order:

  • Two monitors = two HDMI cables per computer. One cable only ever drives one screen.
  • Peripherals ride a separate USB uplink - not the HDMI cables. A plugged-in mouse stays dead until that uplink is connected.
  • Power is separate too. An HDMI KVM doesn't charge a laptop; each machine needs its own charger.
  • Lid closed is its own fight. Switch the KVM away from an Apple Silicon Mac with the lid shut and it sleeps. caffeinate looks like it should stop that but doesn't - it only blocks idle sleep. What actually works is Amphetamine with its Power Protect helper, which we confirmed by closing the lid, switching away, and reading pmset -g log for a clamshell-sleep event that never came.
  • The mic dies when the lid closes. The built-in microphone is sealed inside the shut laptop, so voice input goes silent. Fix: a USB desk mic set as the default input, with a one-command switch to flip back to the built-in mic when I undock and go mobile.
The load-bearing idea. A KVM is what turns "several computers" into "one workstation." Everything else here - the dual HDMI, the closed-lid sleep fix, the external mic - is just the work of making a docked, lid-closed Mac behave like a desktop that happens to be one of four brains you can summon to the same two screens.

The prompt

Paste this into Claude Code (or any assistant that can run shell commands on the Mac) to set the whole thing up - another of your own machines, or a similar rig from scratch. It walks the wiring, closed-lid operation, the microphone, and the foot pedal, and verifies the hard part from the logs. macOS + Apple Silicon.

mac-docking-doctor-prompt.md
You are helping me set up (or replicate) a docked, multi-computer workstation.
The end state: two external monitors and one shared set of peripherals -
keyboard, mouse, microphone, and optionally a foot pedal for push-to-talk voice -
all switched between several computers (laptops and/or a Mac mini) through a
single KVM switch, one keypress to move the whole desk from one machine to the
next. You can run shell commands on this Mac; use them to diagnose and to VERIFY
each step, don't just give generic advice. Work the phases one at a time and
confirm each with a command before moving on.

Assume this unless I tell you otherwise:
- The KVM is a dual-monitor HDMI 2.1 unit with several computer inputs (mine
  takes four).
- Each computer connects to the KVM with THREE separate things: 2x HDMI (one
  cable per monitor), 1x USB uplink (carries keyboard, mouse, mic, and pedal
  together), and its own power. A KVM does not pass power, and it cannot split
  one video cable into two displays.
- This machine is an Apple Silicon Mac that I may run with the lid closed.

PHASE 1 - Inventory what's connected. Run and summarize, before changing anything:
- `system_profiler SPDisplaysDataType` - external displays vs built-in.
- `system_profiler SPUSBDataType` - is the keyboard / mouse / mic / pedal present?
- `pmset -g batt` - AC power or battery?
- `SwitchAudioSource -a -t input` (if installed) - available microphones.

PHASE 2 - Wire this computer into the KVM. Video, USB, and power are three
SEPARATE cables - walk each and check it:
- Video: HDMI carries ONE display per cable (no MST), so two monitors = two HDMI
  cables from this computer into the KVM. Only one monitor lighting up usually
  means the second cable is missing. (Single-cable dual-monitor only works on a
  USB-C / Thunderbolt KVM via DisplayPort MST - not a plain HDMI KVM.)
- Keyboard / mouse / mic / pedal: they all ride a SEPARATE USB uplink cable, from
  the KVM's host / "USB-B in" / upstream port to a USB port on this computer - not
  the HDMI cables. A dead mouse or mic means the uplink isn't connected. Check with
  `system_profiler SPUSBDataType`; if the Mac sees only Apple's own internal hubs,
  the uplink is not attached.
- Power: plug this computer's own charger in separately.
After I fix wiring, re-run the display and USB checks and confirm both monitors
and all the peripherals enumerate.

PHASE 3 - Closed-lid (clamshell) operation, if I want this Mac to keep running
lid-closed while the KVM is switched to another computer. macOS runs lid-closed
only when ALL are true: on AC power, an external display connected, and an external
keyboard/mouse. Switch the KVM away with the lid closed and it sleeps. Simplest
option: leave the lid open (it falls back to the built-in screen). For true
lid-closed:
- Do NOT use `caffeinate` - it only blocks idle sleep, not the lid-close trigger,
  and fails silently here.
- Install Amphetamine (Mac App Store, free - not on Homebrew). Quick Settings ->
  Session Defaults -> UNCHECK "Allow system sleep when display is closed."
- Install its Power Protect helper (Touch ID once). It toggles
  `pmset -a disablesleep`, the real mechanism that holds an Apple Silicon Mac awake
  lid-closed, and it survives the USB/power events a KVM fires when switching
  between computers.
- Start a session (Indefinitely) and stay on AC.

PHASE 4 - Microphone, especially lid-closed. Closing the lid seals the built-in
mic, so anything on the default input (voice dictation, meetings) goes quiet. Set
an external mic as the default:
- List inputs: `SwitchAudioSource -a -t input` (if missing:
  `brew install switchaudio-osx`).
- Switch: `SwitchAudioSource -t input -s "<external mic name>"`.
- Offer to add shell aliases (e.g. `mic-desk` / `mic-laptop` / `mic-now`) so I can
  flip between the external mic (docked) and the built-in (mobile) in one command.

PHASE 5 - Foot pedal for push-to-talk voice (optional). If I have a USB foot pedal,
help me use it as a push-to-talk key for my dictation tool:
- Confirm it enumerates: `system_profiler SPUSBDataType` (find it by name / vendor
  id).
- Program its firmware, or a Karabiner-Elements rule, so a HOLD sends the
  push-to-talk key my dictation tool expects (records while held, release to stop -
  the text lands in the field for me to review, it does NOT auto-send), and a quick
  TAP sends Enter once I've reviewed it.
- Match the key to the tool's ACTUAL push-to-talk binding - check the tool's
  settings, don't assume it's Space; dictation tools quietly migrate their default
  key.

PHASE 6 - Verify the hard part (closed-lid) actually works - prove it from the logs:
1. Baseline: `date "+%Y-%m-%d %H:%M:%S"`.
2. Close the lid, switch the KVM away for ~30 seconds, switch back.
3. `pmset -g log | grep "$(date +%Y-%m-%d)" | grep -i "Clamshell Sleep"` - compare
   to the baseline (filter on BOTH date and time; time-of-day alone pulls prior
   days). Zero entries after the baseline = it stayed awake. If it slept, Power
   Protect isn't active - go back to Phase 3.

At the end, remind me: only run an Amphetamine session when I actually need
lid-closed background work (a closed lid with no external display traps heat), and
switch the mic back to the built-in one when I undock and go mobile.