{"slug": "remotely-unplugging-a-usb-device-on-my-mac-without-touching-it", "title": "Remotely unplugging a USB device on my Mac, without touching it", "summary": "A developer used the open-source tool uhubctl to remotely power-cycle a stuck USB-C device plugged into an M4 Max Mac Studio at the office over a WireGuard VPN, completing a firmware flash that otherwise required a physical unplug. Running `sudo uhubctl -l 8-1 -p 1 -a cycle -d 5` toggled power on the Mac Studio's leftmost front USB-C port (hub 8-1, Port 1) with a 5-second delay, and the developer filed a pull request to add the M4 Max Mac Studio to uhubctl's support matrix, which previously listed only the M4 Mac mini (2 front ports) and MacBook Air (Late 2010) for macOS. The tool does not work with Thunderbolt ports, but all regular USB-C and USB-A ports on the Studio were controllable.", "body_md": "# Remotely unplugging a USB device on my Mac, without touching it\n\nTonight I was remote debugging a USB-C device with custom firmware, which was plugged into my Mac Studio at work. I was accessing it over a WireGuard VPN tunnel.\n\nPart of the debugging process involves flashing firmware to the device using [MIDI SysEx messages](https://www.sweetwater.com/sweetcare/articles/how-do-i-send-and-receive-sysex-on-pc-or-mac/), and while handy, this technique can also be flaky, leaving the device in a partially-flashed state that needs a physical re-plug to recover from.\n\nUnfortunately (well, fortunately, in terms of me taking some time off for Thanksgiving!), I am not physically present at the Mac, and the device I was testing *did* need a physical unplug-and-replug.\n\nI was going to give up, but instead I wondered if there was a way to power off a USB port on macOS, and then power it back on, which would effectively do what I needed.\n\nA little research with Claude uncovered [`uhubctl`](https://github.com/mvp/uhubctl) which allows 'USB Hub per-port power control'—exactly what I wanted.\n\nIt works with Linux or macOS, and supports a ton of USB Hubs, but only listed explicit Mac support for the \"M4 Mac mini (2 front ports only)\" and \"MacBook Air (Late 2010)\".\n\nHoping I'd get lucky, I checked the status on my M4 Max Mac Studio:\n\n``` bash\n# Install uhubctl with Homebrew\n$ brew install uhubctl\n\n# List all available ports\n$ uhubctl\nCurrent status for hub 8-3 [05ac:8009 Apple USB2 Hub 7423J07, USB 2.10, 4 ports, ppps]\n  Port 1: 0100 power\n  Port 2: 0100 power\n  Port 3: 0103 power enable connect [3434:0b10 Keychron Keychron Q1 HE]\n  Port 4: 0503 power highspeed enable connect [05e3:0610 GenesysLogic USB2.0 Hub, USB 2.00, 4 ports, ganged]\nCurrent status for hub 8-1 [05ac:800a Apple USB3 Gen2 Hub 7423J07, USB 3.20, 4 ports, ppps]\n  Port 1: 0203 power 5gbps U0 enable connect [0bad:c0de Device Under Test]\n  Port 2: 02a0 power 5gbps Rx.Detect\n  Port 3: 02a0 power 5gbps Rx.Detect\n  Port 4: 0203 power 5gbps U0 enable connect [05e3:0617 GenesysLogic USB3.0 Hub, USB 3.00, 4 ports, ganged]\n```\n\nI was in luck! The leftmost front USB-C port on the Mac Studio looked to be controllable. I ran the command to power cycle `Port 1` on `hub 8-1` with a 5 second delay between (`-d 5`):\n\n``` bash\n$ sudo uhubctl -l 8-1 -p 1 -a cycle -d 5\nCurrent status for hub 8-3 [05ac:8009 Apple USB2 Hub 7423J07, USB 2.10, 4 ports, ppps]\n  Port 1: 0100 power\nSent power off request\nNew status for hub 8-3 [05ac:8009 Apple USB2 Hub 7423J07, USB 2.10, 4 ports, ppps]\n  Port 1: 0000 off\nCurrent status for hub 8-1 [05ac:800a Apple USB3 Gen2 Hub 7423J07, USB 3.20, 4 ports, ppps]\n  Port 1: 0203 power 5gbps U0 enable connect [0bad:c0de Device Under Test]\nSent power off request\nNew status for hub 8-1 [05ac:800a Apple USB3 Gen2 Hub 7423J07, USB 3.20, 4 ports, ppps]\n  Port 1: 00a0 off\nCurrent status for hub 8-3 [05ac:8009 Apple USB2 Hub 7423J07, USB 2.10, 4 ports, ppps]\n  Port 1: 0000 off\nSent power on request\nNew status for hub 8-3 [05ac:8009 Apple USB2 Hub 7423J07, USB 2.10, 4 ports, ppps]\n  Port 1: 0100 power\nCurrent status for hub 8-1 [05ac:800a Apple USB3 Gen2 Hub 7423J07, USB 3.20, 4 ports, ppps]\n  Port 1: 00a0 off\nSent power on request\nNew status for hub 8-1 [05ac:800a Apple USB3 Gen2 Hub 7423J07, USB 3.20, 4 ports, ppps]\n  Port 1: 02a0 power 5gbps Rx.Detect\n```\n\nThe device was power-cycled and re-connected (along with the corresponding USB 2 port, since both have to be toggled at the same time), and I could finish the firmware update.\n\nWhat a handy tool! It doesn't work with Thunderbolt ports, but all the regular USB-C and USB-A ports on my Studio were available. And apparently it works on most models of Raspberry Pi, though their odd USB configuration means [you can only toggle power to all four ports at once](https://github.com/mvp/uhubctl#raspberry-pi-5).\n\nSince it wasn't in the support matrix yet, I filed a PR to add the Mac Studio: [Add M4 Max Mac Studio](https://github.com/mvp/uhubctl/pull/691).", "url": "https://wpnews.pro/news/remotely-unplugging-a-usb-device-on-my-mac-without-touching-it", "canonical_source": "https://www.jeffgeerling.com/blog/2026/remote-control-usb-hub/", "published_at": "2026-11-27 05:18:00+00:00", "updated_at": "2026-11-27 05:47:30.253552+00:00", "lang": "en", "topics": ["developer-tools"], "entities": ["uhubctl", "Apple", "Mac Studio", "M4 Max", "WireGuard", "Homebrew", "Claude", "Mac mini"], "also_reported_by": [], "takeaway": "On an M4 Max Mac Studio, `sudo uhubctl -l 8-1 -p 1 -a cycle -d 5` power-cycles the leftmost front USB-C port, forcing a re-plug of a stuck device remotely; Thunderbolt ports are not supported.", "recommendation": {"advice": "Install uhubctl via Homebrew and use `-a cycle -d 5` on the target hub and port to remotely power-cycle a wedged USB device; verify the port shows 'ppps' in `uhubctl` output first, and expect Thunderbolt ports to be unsupported.", "playbook": "production-ops", "playbook_url": "https://wpnews.pro/playbooks/production-ops"}, "alternates": {"html": "https://wpnews.pro/news/remotely-unplugging-a-usb-device-on-my-mac-without-touching-it", "markdown": "https://wpnews.pro/news/remotely-unplugging-a-usb-device-on-my-mac-without-touching-it.md", "text": "https://wpnews.pro/news/remotely-unplugging-a-usb-device-on-my-mac-without-touching-it.txt", "jsonld": "https://wpnews.pro/news/remotely-unplugging-a-usb-device-on-my-mac-without-touching-it.jsonld"}}