Jump to content

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.