Hacker News new | ask | show | jobs
by eigenvalue 1522 days ago
If you absolutely want to prevent a Mac from not only going to sleep, but restarting for any reason at all (say, to install important security updates, which are usually forced on the user with no choice), there aren't many good ways. The only thing I've found that really works reliably is to open MS Word, create a new document, add some random characters to it, and then leave without ever saving. Word will prevent the OS from doing anything that would cause you to lose that unsaved document. I'm sure the MS engineers dug deep into the kernel to find something foolproof. It's a bit annoying that Apple doesn't give you a little switch like that which you could toggle to say "don't restart for any reason at all".
10 comments

Same thing happens with JetBrains IDEs. I usually set my Mac to update after midnight but usually find it got stuck with the IDE asking “are you sure you want to quit?”
"This application prevented shutdown..."
Amphetamine[0] works pretty well for me. They also have an extension (a kext, I think) that gives it more reliability. I don't know how reliable it is without that extension though.

[0]: https://apps.apple.com/us/app/amphetamine/id937984704?mt=12

I've been using the more bare-bones KeepingYouAwake[0] just because I came across Caffeine first and this was suggested as the continuation of that simple utility. The icon makes it obvious whether it is enabled or disabled

Edit: I see now that Amphetamine has the option of a similar-looking icon to make it more obvious whether it is enabled or not

[0] https://github.com/newmarcel/KeepingYouAwake

(My first HN comment, via Orion Browser)

I used Caffeine for years and never really thought about it much, it's always been useful. But I installed Amphetamine lately on a new MBP and I've used the schedule and countdown modes multiple times now. It's a great tool and the added functionality is useful.
> (My first HN comment, via Orion Browser)

Did you manually type that out or is this some “Sent from my iPhone”-esque growth-hacking strategy by the Orion team?

Not from Orion, would be pretty invasive if it was (Orion dev here).
Thanks for clearing that up. I happened to get your beta invite the same day and was a bit over excited about it, I guess

Thanks for working on Orion!

And it does specifically need to be a third party application like Word. Built in apps like TextEdit support state restoration, so it will probably still reboot if you have unsaved content in TextEdit.
The windows equivalent to this is an unsaved text file in notepad.
PowerToys[0] has a utility for that. It stays in the corner of the taskbar.

[0] https://github.com/microsoft/PowerToys

This is good for users who don't have admin rights but want to keep online for employee monitoring purposes.
This burns me at least twice a week. I'll go to bed and 15 mins later I'll notice my computer is still on... it's always notepad.
An open iTerm terminal or Emacs window also fulfill this function for me (usually unintentionally)
You can also do this in the browser, using the beforeunload event

https://developer.mozilla.org/en-US/docs/Web/API/Window/befo...

I have the opposite problem. I want it to restart overnight and come back to find it blocked by my terminal being open.

Incidentally iTerm will block a restart too, and is useful to have open all the time anyway!

I’ve been using 10 hour videos of black screen with success.
Open a vim session in Terminal. Active processes prevent Terminal from quitting which prevents shutdown from proceeding
Why would Word do all that craziness instead of just saving a copy of the document like it did 20 years ago?