MacBook – SSH to Macbook works when lid closed (and plugged in to power)

macbook propower-managementpower-napsleep-wake

I noticed that my PuTTY session to my MacBook (which is now on Mavericks 10.9.3) seems to stay alive with the clamshell closed so long as the power cable is plugged in to the laptop. This can be seen by unplugging the power, the terminal stops responding after 10 seconds or so, but comes back once I plug power back in, all while the cover is closed.

While this is extremely convenient given how my desk is set up, I can't help but wonder how overheating can be prevented. Obviously some reasonable level of CPU clock and power management would take care of it, but I would only be extremely impressed and remain incredulous that this is something that has been achieved.

So, what's going on here? Is this the "Power Nap" feature at work? If I start running some CPU loading benchmark from the command line now, what will happen?

I tested just now by running yes > /dev/null & yes > /dev/null & yes > /dev/null & yes > /dev/null &, and it sure did get the fans spinning, I open it up and it was definitely pretty toasty, so that would not have been good if I had the machine out of physical reach.

Best Answer

Yes, this is the Power Nap feature at work. On Mac notebooks, by default, Power Nap is configured as enabled when it's connected to AC power and configured as disabled when on battery (you can see this from System Preferences > Energy Saver). This is why you're seeing different behavior when connected to mains power and when on battery.

You don't have to worry about overheating since the Power Nap feature comes with built-in protection for it. Read the OS X: About Power Nap article for more information. It states (emphasis mine):

Power Nap communicates and transfers data for a only a few minutes per Power Nap cycle when running on battery. When connected to a power adapter, communications and data transfers are continuous. When Power Nap is enabled your computer may be warm to the touch even if it is sleeping. Power Nap operations are suspended when your computer exceeds a predefined temperature so that your computer does not overheat.