Prevent sleeping Mac after shutting down?

I am writing a program in C and I want it to have an option that will support the Mac laptop, even if the lid is closed, so the processes can continue. There seems to be very little information on this topic, so I really don't know where to start. If someone knows how to do this or where I can find more information, I would really appreciate it (for example, will I need to work with the BIOS for this, or do I have built-in functions?). Also, if it is easier to do this in another language, this is normal since I am not stubbornly installed using C.

+6
c macos
source share
4 answers

To do this, you need to write a kernel extension. OS does not support it by default, because laptops are not designed to cool properly when the cover is closed, and the internal display is on. SleepLess is a $ 10 utility that will do what you want. If you warp the display or something else, this is your own mistake. :-).

If you want to write something yourself, LidSleep.kext looks like a good start (it does the opposite, that is, sleeping on the lid close) and comes with source code.

(It’s possible and supported to wake some Mac laptops with a closed screen using an external input device.)

+3
source share

You can do this using the Kit I / O framework, see QA1340 Listing 2 for sample code using IOPMAssertionCreateWithName to temporarily prevent sleep mode.

+2
source share

The link to LidSleep.kext above does not work, so I can report that the author of NoSleep provided the source code here, so you can see for yourself how to do this:

https://code.google.com/p/macosx-nosleep-extension/

0
source share

If your laptop is a fairly modern model, you do not need to add anything. If you use Lion, it just works. If you are using an older OS, you need to wake up with a laptop, sending it by pressing a key or clicking the mouse from an external keyboard or mouse. See http://support.apple.com/kb/ht3131

-2
source share

All Articles