integralpro / nosleep

The MacOS X kernel extension, preventing sleep when you close the lid.
GNU General Public License v2.0
874 stars 45 forks source link

Anticipate the deprecation of Kernel extension #49

Closed bric3 closed 2 years ago

bric3 commented 4 years ago

Deprecated Kernel Extensions and System Extension Alternatives

System extensions on macOS Catalina (10.15) allow software like network extensions and endpoint security solutions to extend the functionality of macOS without requiring kernel-level access. At WWDC19, we announced the deprecation of kernel extensions as part of our ongoing effort to modernize the platform, improve security and reliability, and enable more user-friendly distribution methods. Kernel programming interfaces (KPIs) will be deprecated as alternatives become available, and future OS releases will no longer load kernel extensions that use deprecated KPIs by default.

Transitioning Your Kernel Extensions

If your software uses deprecated and supported KPIs, you’ll need to factor out deprecated components into a stand-alone system extension. If your software uses new system extensions and legacy kernel extensions, you can distribute to supported operating systems. Software that supports a broad range of macOS versions should continue to use kernel extensions for older versions and run system extensions where supported.

Below is a list of deprecated KPIs as of macOS 10.15. In macOS 10.15.4, use of deprecated KPIs triggers a notification to the user that the software includes a deprecated API and asks the user to contact the developer for alternatives.

https://developer.apple.com/support/kernel-extensions/

I'm not sure however how this can translate for NoSleep ?

Tatsh commented 4 years ago

In macOS 10.15.4, use of deprecated KPIs triggers a notification to the user that the software includes a deprecated API and asks the user to contact the developer for alternatives.

I have not received a message about NoSleep.

The code has to be adapted to use DriverKit and then for its own distribution has to use an entitlement from Apple.

As far as I can tell, equivalents exist for this code to work. It just has to be ported.

viktor-podzigun commented 3 years ago

And the kernel stops loading now on:

Tatsh commented 3 years ago

It's working for me.

 $ kextstat | grep -Fv apple && uname -a && sw_vers
Executing: /usr/bin/kmutil showloaded
No variant specified, falling back to release
Index Refs Address            Size       Wired      Name (Version) UUID <Linked Against>
  180    0 0xffffff7fa241c000 0x2000     0x2000     com.protech.NoSleep (1.5.1) 7B0BAE0B-9B3E-3A45-A49C-EA6A314D2170 <6 5 3>
Darwin cccccccccc-wifi.tat.sh 20.3.0 Darwin Kernel Version 20.3.0: Thu Jan 21 00:07:06 PST 2021; root:xnu-7195.81.3~1/RELEASE_X86_64 x86_64 i386 MacBookPro14,3 Darwin
ProductName:    macOS
ProductVersion: 11.2.3
BuildVersion:   20D91

You may need to System Preferences -> System and click on Allow in the General tab.

viktor-podzigun commented 3 years ago

Indeed, it works, after starting it again for me, probably was some issue during system startup on my side. Sorry for the false-positive.

Thanks @Tatsh for the Allow hint!

sla797 commented 3 years ago

I have the same problem as Viktor, but this occurs after 'Allowing' access in the Privacy & Security tab on MacOS Big Sur 11.6 (latest at today's date).

integralpro commented 2 years ago

@sla797 has the right answer