6 ms·
I would add caffeinate, which prevents the Mac from going to sleep. It can do this indefinitely, for a fixed period of time, or after a process is done running.
by guan 11y ago
I would add caffeinate, which prevents the Mac from going to sleep. It can do this indefinitely, for a fixed period of time, or after a process is done running. You can even specify that process either as the PID of an existing process or by invoking it through caffeinate itself.
- _asummers 11y agohttps://itunes.apple.com/us/app/caffeine/id411246225?mt=12 https://itunes.apple.com/us/app/caffeine/id411246225?mt=12 I use this all the time, it's the GUI version presumably.
- guan 11y agoIt uses the same underlying API. I use it too. It’s only on–off, though, so you have to remember to turn it off.
- lvillani 11y ago> It uses the same underlying API I don't think so. For whatever reason Caffeine doesn't take a power assertion, as show by `pmset -g assertions`, whereas caffeinate does. This is what prompted me to write Theine (https://github.com/lvillani/theine https://github.com/lvillani/theine) to use the proper API for this task, since Caffeine would behave erratically with the lock screen active.
- guan 11y agoThat’s odd. Do you have any idea what API they use?
- lukeholder 11y agoRecommend "Amphetamine" as an alternative. More features and kept up to date with bug fixes and improvements. I am not affiliated, just a happy user.
- jason_slack 11y agoCan you explain why one might use this, versus just setting the machine to not sleep in System Preferences, in combination with not turning off hard disks, etc? I still set my display to sleep, however. Am I missing something?
- pavel_lishin 11y agoYou may want your machine to go to sleep normally - e.g., when you leave it on your desk at home and go to sleep - but not when you're at a hackathon, and are running some process while you go and get a snack, or are presenting a video that requires no actual input from you.
- jason_slack 11y agoah, I see, a `selective` sleep. Makes sense, I am going to check this out. Thank you.
- marcosscriven 11y agoI found Hammerspoon effectively replaced this utility, and a host of others, with simple Lua scripts. http://www.hammerspoon.org http://www.hammerspoon.org
- mrmondo 11y agoThanks for that - I've been looking for something slightly more advanced than caffeine for a while and this is perfect!