5 ms·
TIL: caffeinate Very useful.
by selectnull 2y ago
TIL: caffeinate
Very useful.
- vallode 2y agoIndeed, many applications I would expect to prevent sleeping (some audio playback ones, games, etc.) don't implement this. I assume it's a case of Apple's APIs changing over the years and not everyone catching up/caring. At one point I had downloaded Amphetamine[^1] but it is much nicer to just use the terminal here. [^1]: https://apps.apple.com/us/app/amphetamine/id937984704 https://apps.apple.com/us/app/amphetamine/id937984704
- m1keil 2y agoAlso https://github.com/newmarcel/KeepingYouAwake https://github.com/newmarcel/KeepingYouAwake
- galad87 2y agoThe "newest" and still supported low level API is almost 14 years old: https://developer.apple.com/documentation/iokit/kiopmassertiontypepreventuseridlesystemsleep/ https://developer.apple.com/documentation/iokit/kiopmasserti... https://developer.apple.com/documentation/iokit/kiopmassertiontypepreventuseridledisplaysleep https://developer.apple.com/documentation/iokit/kiopmasserti...
- keybored 2y agoI was able to install a `caffeine` package with Apt on Linux. In that one the `caffeinate` command is supposed to be run with another command. While the `caffeine` command does what macOs `caffeinate` does.
- huskyr 2y agoFor a GUI version, Amphetamine is quite nice (and free). https://apps.apple.com/us/app/amphetamine/id937984704?mt=12 https://apps.apple.com/us/app/amphetamine/id937984704?mt=12
- neevans 2y agoyes amphetamine I use regularly when I want to charge my android phone during travel with lid closed.
- walthamstow 2y agoThat's interesting, I have never needed to do that. My Pixels have always just charged even if the lid is closed, on Intel and Apple Silicon machines. I like to travel light so I often use my laptop as a battery bank instead of carrying a seperate one.
- weberer 2y agoIt would be cool to have this activate when a Jupyter notebook is currently running a cell, and deactivate automatically when its finished.
- eszed 2y agoThis can be done by passing a PID. I believe there are other options, as well. (Not at my computer to look it up right now.) I haven't used those features "manually", but I have in scripts that I expect to generate long-running processes.
- al_borland 2y agoWhile it may avoid sleep, it doesn’t prevent inactivity, in my experience. For instance, my chat app at work will still show me inactive while running caffeinate. I have to do non-interactive training semi-regularly and need to interact to keep from looking like I’m away from my desk.