Archived Coding

What is a Kext?

A common misconception seen on a lot of places is that a .kext file is some sort of driver for the Mac OS. That is not entirely true – the kext resembles a driver but does a lot more than just act as a driver!


kext stands for Kernel Extension and is an extension used by special files in the Mac operating system (OS). These files are often pretty small and act as an interface between the core of the OS and hardware (such as WiFi-cards, Bluetooth-cards, trackpads, graphic cards), filesystems and other items central to the OS’s operation. They can be written and compiled in different programs, but many people use XCode because of the compability and ease of compiling. When working with osx86-installations or hackintosh-related systems, one often needs to write modified kext’s to enable the OS to recognize certain hardware – without them a “hacked” Mac OS would not be possible.

Where are the kext’s located?

In the Mac operating system, most, if not all, kext’s are located in the same place – the /System/Library/Extensions folder. At boot, all the kext’s needed are cached into a file called Extensions.mkext prior to being loaded. To clear the extension cache after installing a new kext, simply delete this file and it will be re-created (resulting in a slightly slower boot speed). If you’re looking to start coding your own extension, you might want to check out Apple’s Dev Center’s kext section – it includes examples and tutorials to get you started.

How do I install a kext?

The simplest and most straight-forward method of installing and applying a kext is to use the Kext Helper application. Simply install it, run it, choose the kext you wish to apply and enter your password – it will do the job for you, backing up any kext’s you overwrite and even optionally showing you what it’s doing. Upon completion, restart your computer and your new kext will be applied!
If you’re looking for a more advanced way of applying a kext, you can follow the following steps:

Rename the kext you will be updating – doing this will ensure you have a backup of your old kext in case any problems arise.
cd /System/Library/Extensions
mv KextName.kext KextName.old

Copy the kext to the main kext-folder.
cd /path/to/new/kext (put your downloaded kext path here)
cp -R KextName.kext /System/Library/Extensions

Next, you must alter the permissions of the file in order to allow the system to execute it (make it an executable).
cd /System/Library/Extensions
chmod -R 755 KextName.kext
chown -R 0:0 KextName.kext (this will set the ownership on the file to you)
rm /System/Library/Extensions.mkext (removing the kext cache in order to update the kexts)

Hope this cleared up some of the questions that often arise! Good luck with your modding!


2 replies on “What is a Kext?”

Comments are closed.