Jump to content
  • Announcements

    • Allan

      Forum Rules   04/13/2018

      Hello folks! As some things are being fixed, we'll keep you updated. Per hour the Forum Rules don't have a dedicated "Tab", so here is the place that we have our Rules back. New Users Lounge > [READ] - InsanelyMac Forum Rules - The InsanelyMac Staff Team. 

What is a kext and how do you install and patch it?

1 post in this topic

Recommended Posts

What is a kext?
Kext is an abbreviation for kernel extension; it is basically the Mac OS equivalent to a Windows driver.

Where can I find these kexts?
Kexts are normally placed in /System/Library/Extensions. However, if you have Snow Leopard or earlier (and some custom Lion systems), kexts are also placed in /Extra/Extensions.

How do I install a kext, and which Extensions folder should I use?
For the most part, the choice of Extensions folders is yours; unless the user/developer got the kext from specifically states which folder, basically kexts can go in either, with the following considerations: for kexts in /Extra/Extensions that are supposed to override duplicates in /System/Library/Extensions (i.e. IOATAFamily), the kext in /Extra/Extensions must have a higher version number than the kext in /System/Library/Extensions (this can be checked in a kext's Info.plist, which I'll show you how to access in a bit); kexts with a ton of dependencies (that is, they require a lot of other kexts to already be present for it to load) need to be in /System/Library/Extensions, and for kexts that could be replaced in software updates by Apple's originals (for example, IONetworkingFamily) should probably be in /Extra/Extensions. If you are confused by this, just experiment and see what works for you. :)

As for installing a kext, the method depends on where you place it. For /System/Library/Extensions, the OS is SUPER specific about what the permissions are in order for it to load; if it's not just right it won't load at all. So, if you are installing a kext manually, drag it in /System/Library/Extensions, open the Terminal (/Applications/Utilities), and type the following commands:

cd /System/Library/Extensions
chmod 775 [yourkext].kext
chown root:wheel [yourkext].kext

Then your permissions are correct. :) If you don't want to worry about Terminal commands you can use a third-party utility to install the kext (I recommend Kext Utility).

If you are installing in /Extra/Extensions, good news: there are no permissions issues here. :D Just drag the kext in and it should work.


Just go to EFI/Clover/kexts/ and select which the folder you'll put the kext.
And you don't have permissions issues there too.  ;)
Note: For OS X detect and inject these kexts in Clover folders, you need add this option in your config.plist:

See more here: CloverWiki/SystemParameters


Once you install a kext, you have to update the kext caches (for instructions see this FAQ), then you can reboot.


How do I patch a kext?
Well, first you need to determine where your kext is; is it in /Extra/Extensions or /System/Library/Extensions? Once you find that out you open Terminal (/Applications/Utilities), and type one of the following commands depending on where your kext is:

sudo nano /System/Library/Extensions/[yourdriverhere].kext/Contents/Info.plist
sudo nano /Extra/Extensions/[yourdriverhere].kext/Contents/Info.plist

If you need to patch a plugin inside a kext, you would type the same command with a twist:

sudo nano /System/Library/Extensions/[yourdriverhere].kext/Contents/PlugIns/[yourplugin].kext/Contents/Info.plist
sudo nano /Extra/Extensions/[yourdriverhere].kext/Contents/PlugIns/[yourplugin].kext/Contents/Info.plist

Under normal conditions what we do when we patch a kext we are inserting your PCI ID into the kext (for info on PCI IDs, see this FAQ)
Scroll with the arrow keys and look for IOPCIPrimaryMatch or IOPCINameMatch (If there happens to be a IOPCIClassMatch instead of the other two mentioned above, change IOPCIClassMatch to IOPCIPrimaryMatch). Below it you should see at least one string of numbers (and letters) preceded by 0x (unless it says IOPCINameMatch; then in that case it will say pci instead of 0x). Delete all the strings (including any that say &amp before them) and type in your ID in the order 0x[deviceID][vendorID] (for IOPCINameMatch, it would be pci[vendorID], [deviceID]). So, for example, if you have an Intel (vendor ID 8086) Ethernet card with the device ID 27dc, you would type 0x27dc8086 (or pci8086, 27dc if it is IOPCINameMatch). Once you're done, press Control-O and then Control-X. Reboot, at the boot prompt type -f, and that should do the trick. :)

Edited by Allan
Updated 04/30

Share this post

Link to post
Share on other sites

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Posts

    •   Boot option name retrieval 1) Locate the booter image as explained blow. 2) Locate ".contentDetails" in the parent folder 2.1) if unsuccessful, locate ".disk_label.contentDetails" in the parent folder 2.2) if unsuccessful, retrieve the volume's name   HFS Boot 1) Retrieve blessed file via https://github.com/CupertinoNet/EfiPkg/blob/development/Include/Guid/AppleBless.h#L41 1.1) if unsuccessful, retrieve blessed folder via https://github.com/CupertinoNet/EfiPkg/blob/development/Include/Guid/AppleBless.h#L45, append "\\boot.efi". NOTE: This is broken in the latest binary I checked. 1.2) if unsuccessful, use the following hard-coded paths: "\System\Library\CoreServices\boot.efi", "\EFI\APPLE\{ARCH}\BOOT.EFI", <StandardEfiPath>, "\\boot.efi" in this order 2) FV2 Recovery does not follow the usual practice because it is not shown by BootPicker anyway. Determine it via https://github.com/CupertinoNet/EfiPkg/blob/development/Include/Guid/AppleBless.h#L49, verify it does not match 1).   APFS Boot 1) Determine the APFS Volume Info (and hencefor detect whether it is APFS in the first place) via https://github.com/CupertinoNet/EfiPkg/blob/development/Include/Guid/AppleApfsInfo.h#L54 1.1) Determine the APFS Container Info via https://github.com/CupertinoNet/EfiPkg/blob/development/Include/Guid/AppleApfsInfo.h#L36 1.2) Verify the Volume Role via https://github.com/CupertinoNet/EfiPkg/blob/development/Include/Guid/AppleApfsInfo.h#L51 1.3) Retrieve blessed file analoguous to HFS 1). NOTE: This step and 1.3.1) are broken in the binary I checked, hencefor it does not happen, but is probably supposed to. 1.3.1) if unsuccessful, retrieve blessed folder and append the booter name the same way as in HFS 1.2) 1.4) (if unsuccessful,) locate all Volumes that are part of the same container, check whether the current Preboot partition has folders named by the just located Volumes' GUIDs and append the hard-coded paths from HFS 1.2) if existant 2) Recovery detection works the same way as 1.4), just for a Recovery instead of a Preboot volume
    • Got garbled sound in earphone    Notebook Asus X550VX i7 - 7700hq with ALC255 not working with applealc  layout id  3, 13, 17, 18, 27, 28, 99 its is working with VoodooHDA but the new one 2.9.1 it much has low volume, but bad sound in earphone     codec dump linux https://drive.google.com/file/d/1pg2y76WvFYsO8vFY-2B_2OLyKMmkQ8Tg/view     latest debug http://www.mediafire.com/file/2pjny4eq5r64ed8/debug_1383 (1).zip  
    • For F6 Bios, which DSDT is the one i should use? I´m a little confused in the Mass of DSDT here ;-).   Great Thread by the Way.   Another Question: I have 2 960Pro inside my Rig (one with OS X, one with Windows 10). When i try to mount my EFI on OS X NVMe the system freezes... :-(   DWhen i unplug the Windows NVMe everything is fine an it mounts the EFI.   Anybody an idea?   Tried the upper Port on the Board (OS X) & the middle / lower Port, in the Middle it mounts the EFI in the lower it freezes.   But i need the middle Port for an SATA M.2 SSD :-D... Even when i plug the Windows NVMe into an PCIe Adapter Card it freezes at the point i mount the EFI.   I´m mounting with Clover Configurator.     Thank You guys.
    •   Just add "ngfxsubmit=0" to config.plist to disable the fix within nvidiafixup
    • @MegaCookie   ok, I have no solution for that Trial 7 good for the release?
      Is this codec good enough for you?