Not being an Apple user, every now and then I hear something which is surprising to me. Today is one such day.
I was talking to people about closing a laptop's lid and how I prefer to have my screen lock and go off but to not actually suspend or hibernate or anything like that unless I explicitly tell it to.
One Apple user indicated that "there's no way to do this on a MacBook. Closing the lid will *always* shut the machine down" (or, you know, put it to sleep)
Is this actually true? How can this be true? Is there literally no power configuration setting which would allow you to close the lid on a running MacBook without having it stop doing all the things that it is doing?
EDIT: Apparently an older Mac tool, Caffeinate, can do some of this... but the real answer appears to be a fork of that former tool which is still an active project and being maintained, etc, and it's called Amphetamine. Thank you to all who offered ideas, the replies were insightful.
@deviantollam From my experience, this is situationally false.
* On battery, it locks the machine (if encrypted) and can put it into an *optional* low power mode that remains online to receive data (think backups, email, etc).
* On power adapter you can totally configure it to power off the screen but otherwise remain available for use. It’s how I often use my Macbook Pro.
Unsure of how macOS handles actual power states at the firmware level, but it’s generally just as configurable as a Windows box - with the benefit of not fucking up multiple displays when moved about.
@deviantollam No, there is a setting on macs just like windows to allow the laptop to run while closed.
@aria_unbound that would seem to contradict what other people are saying. If you know where this setting is, I would love to hear it!
@deviantollam you can run it in clamshell mode as long as you have an external display attached; otherwise if you close it, it goes to sleep (as there really isn't any way to do anything on it with the lid closed if you don't have an external display attached; Apple does not consider the use cases of “I'm compiling something that will take an hour" or “I want to keep it closed but still SSH to it”, etc., as things to support)
@darkuncle other people seem to think there's a setting for this, however
@deviantollam there's the "prevent automatic sleep when display turns off if power supply is connected" in battery/energy settings (worded differently on desktop)
and then there's Caffeine with Closed Display Mode which can keep the thing awake without a mouse / keyboard / display even connected (usually macbooks require all three to be connected to prevent sleep)
@traumaphoenix is caffeine a third-party app? Somebody else mentioned a third-party app called amphetamine. Don't know if that's a similar thing or a fork of the project or something else
@deviantollam correct. You can use a third party program to prevent it from sleeping when you close the lid, but this also means the screen stays on 🙃
@smn Wait, what??
Why in the goddamn piss shit hell would anyone want the screen to stay on?
@Mataway A few people have mentioned that as well as a tool called caffeine (Related app? Different product?) but One person said that tools like this keep the display on with the lid closed. Which is easily the dumbest fucking thing I've ever heard.
At least a few years ago, it was common among people who had a need to run macbooks with the lid (almost) closed (for example when compiling iOS software in a CI setup) to 3D print little wedges that they'd insert between the laptop and the screen. The wedges were just thick enough not to trigger the "lid is closed" magnets.
@farhaven Yes I've seen people do that. And all I can say is Jesus have some fucking dignity
@deviantollam Whaaaaaaaaa? I've run this mac and it's predecessor in clamshell mode for six years now. Now, the fact that I have an external monitor plugged into it before the initial close may have something to do with it... I don't even remember how I set it up, but _I know it's possible,_ because I'm typing on a mac that has been closed for... 25 days now?
I suspect if I yank its power cord it'll sleep (I'm pretty sure of that) or if I yank both monitors it will sleep... but with two monitors up and it plugged in? it WILL NOT GO TO SLEEP. If I lock its screen it'll happily go power-*saving* after a minute or two but it won't go full sleep mode and stay that way.
(Which is YA reason I'm happy to _work_ on a mac, but when I buy something that's _mine_? Linux, usually Lenovo. Because DO WHAT I MEAN DAMMIT. If I don't like it, I can f*** with it until it does what I mean it to do.
Mostly. :)
@stonebear2 Yes I'm aware of the external keyboard or external monitor situation but I'm talking about someone who wants to just pick up their laptop, tuck it under their arm, walk to another part of the office, and then sit down 20 minutes later and keep working
@deviantollam you should be able to tell it to just sleep. It will lose active TCP connections, but all your windows will be right where you left them. I don't think it will just ignore being closed without being plugged in, though..
@stonebear2 that's the entire thing that isn't wanted, however. going to sleep = bad. losing TCP connections = bad
@darkuncle @deviantollam at least back in the day it was totally adjustable in preferences, i doubt they'd remove that lol
@valpackett @deviantollam I've never seen an option to keep it running with the lid closed, unless you have a display attached ¯\_(ツ)_/¯
@woody @valpackett @deviantollam Amphetamine! I remember that one now, thanks woody.
@jrunyon @darkuncle most people want their laptop to keep doing the things it was already doing: Transferring files, downloading, uploading, rendering video, compiling code, you name it.
@deviantollam sorry yeah Amphetamine
i think it's a fork or inspired by of a project that was called caffeine because of the macos command by the same name, but that's long gone (the app, the command still works great)
sudo pmset -a disablesleep 1