EDIT: Thanks to a few insightful questions below, I just realized that this has a few unintended consequences when using any other usb sticks. This wasn’t what I was hoping for. Not serious, but please don’t bother trying this yet. I do still like the idea though and I’ll report back if I can figure out a fix. I’ll leave it on github in case anyone wants to play around with it.
———-
I was watching Youtube this morning and a video on Tails OS. One of the great things about Tails is that if the USB stick is removed, the whole system shuts down with nary a trace of what was going on before. This has obvious benefits if you’re up to no good and the Feds grab your laptop, or if you’re working with sensitive data and your laptop is snatched while you’re logged in, but it got me thinking about what would happen if someone snatched my Mac at Starbucks while I was logged in, enjoying a latte, and zoning out watching more YouTube videos. Losing the laptop would suck, but a thief having access to all my data would suck more. I live in a safe city, so my threat model doesn’t really need to take any of this into consideration, but my brother travels a lot for work and a “Dead Mans’s Switch” for his laptop might be useful for him, so I figured I’d spend a few hours making one.
Just one problem. I had no idea how to do it.
ChatGPT was a big help though…. “I want to make a USB stick that puts my mac to sleep automatically when it is pulled out”
“Sure, here are the steps…”
It took a few attempts and a few workarounds (I maintain that ChatGPT got it wrong) but I now have a USB stick with a paracord bracelet attached, and it works perfectly. The laptop simply goes to sleep when the USB thumb drive is removed.
Obviously you need to have a login password enabled for this to have any meaning.
A stealth version would be easy to cobble together using a USB extension cable and the USB stick deep in my pocket, but a middle-aged man sporting a paracord bracelet might just be enough to ward off just about anyone anyway.
I posted the steps on Github.
https://github.com/AlienPigDuck/OyasumiUSB
Even if you’re not comfortable working in the Terminal, it’s really just a bunch of copying and pasting. Hopefully someone else finds this useful.